: This article mainly introduces how Yii uses the migrate command to execute SQL statements. For more information about PHP tutorials, see. This example describes how Yii uses the migrate command to execute SQL statements. We will share this with you for your reference. The details are as follows:
Yii2 comes with a powerful command line management tool. in windows, click the cmd command window and switch to the Directory of the Yii project (including Yii. bat) to run the Yii command in cmd.
Run the Yii migrate command to execute the SQL statement:
For example, if the SQL statement of a User table is defined in the file/console/migrations/m130524_201442_init.php in the path, execute this SQL statement to generate a data table and run it:
Yii migrate console/migrations/m130524_201442_init.php
Migrate is the Yii command for data migration, which is only one of the usage.