D
D
DarkByte20152017-10-17 16:45:14
Yii
DarkByte2015, 2017-10-17 16:45:14

How to change column in migration after creation?

In a migration, when creating, you can specify for a column, for example

$this->string()->after('column2')->defaultValue('test')->notNull()

But how can you change all this? Of the methods for changing a column, I found only $this->renameColumn. What about everything else? For example, set a position or a default value that was not initially set ... How can I do all this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-10-17
@DarkByte2015

www.yiiframework.com/doc-2.0/yii-db-migration.html...

$this->alterColumn('user','score','integer NOT NULL');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question