Adding a few extra columns using Yii2 migration

It’s just interesting that it’s best to add new columns through migration to yii2. The documentation seems to imply adding extra columns that you have to do one for each migration, at least in this example. Yii2 Migration - Add a column . Is this true, or is it normal to add multiple ADDITIONAL columns in one migration? If you would use a specific migration naming convention, for example add_xxx_and_zzz_column_to_yyy_table. Hooray!

+4
source share
1 answer

This is not clear from the docs, but you can create multiple columns in a single transition:

yii migrate/create add_xxx_column_yyy_column_to_zzz_table --fields="xxx:integer,yyy:text"
+5

Source: https://habr.com/ru/post/1668178/


All Articles