Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding multiple additional columns using Yii2 Migration

Tags:

php

yii2

Just wondering what the best way is to add new columns via a migration in yii2. The documentation seems to imply when adding additional columns you should do them one per migration, well at least in the example. Yii2 Migration - Add Column. Is this the case, or is it OK to add multiple ADDITIONAL columns in a single migration? If so would you use a specific migration naming convention like add_xxx_and_zzz_column_to_yyy_table. Cheers!

like image 989
johnsnails Avatar asked Jan 29 '17 10:01

johnsnails


1 Answers

It isn't clear from the docs but you can create multiple columns in one migration:

yii migrate/create add_xxx_column_yyy_column_to_zzz_table --fields="xxx:integer,yyy:text"
like image 91
topher Avatar answered Oct 03 '22 23:10

topher