This article describes the example of Yii using the migrate command to execute sql statements. Share it with everyone for your reference, the details are as follows:
Yii2 comes with a powerful command line management tool. Open the cmd command window under Windows, switch to the directory where the Yii project is located (including Yii.bat), and you can run the Yii command in cmd.
Use Yii migrate command to execute sql statement:
For example, the file with the path /console/migrations/m130524_201442_init.php defines the SQL of a User table. If we want to execute this SQL to generate a data table, run:
yii migrate console/migrations/m130524_201442_init.php
migrate is Yii’s command for data migration, and this is just one of its uses.
Reprinted from: Xiaotan Blog http://www.tantengvip.com/2015/05/yii-migrate-sql/
Readers who are interested in more Yii-related content can check out the special topics on this site: "Introduction to Yii Framework and Summary of Common Techniques", "Summary of Excellent PHP Development Framework", "Basic Tutorial for Getting Started with Smarty Templates", "php Date and Time" Usage Summary", "php object-oriented programming introductory tutorial", "php string (string) usage summary", "php mysql database operation introductory tutorial" and "php common database operation skills summary"
I hope this article will be helpful to everyone’s PHP program design based on the Yii framework.