yii2 create a data table through migration

### yii2 create a data table through migration

Ready to work:

1. First written guarantee php environment variable
2. Create migrations directory (base version of the need to manually create) within the project
3. The configuration file is properly configured database information (user name and password, etc.)

Begin execution

1. Create a migration file

//yii migrate/create 表名称
yii migrate/create wx_card_consume

2. Perform migration to create a table in the database

yii migrate/up   //这是执行所有的up方法,也可以指定单个的migration文件

Guess you like

Origin www.cnblogs.com/alisleepy/p/11200341.html