Reputation: 1015
I support the Yii 1.1.14 application and I have to add the new column into my database table in migration file. I use the next:
$this->addColumn('table', 'columnName', 'varchar(100)');
How can I set the default value for this column? And, also, I want to place the column after the concrete one.
Or, maybe, should I use the another method?
Thanks.
Upvotes: 1
Views: 1866
Reputation: 68
The easiest way is:
$this->addColumn('table', 'columnName', "varchar(100) DEFAULT 'my default string'");
Upvotes: 2