Data Migration Tool (Think-migration) is provided in THINKPHP5, which is the opportunity Phinx Development (document address:http://docs.phinx.org/en/latest/)
One: Configuration think-migration
Add in commond.php
<? PHP return [ "Think\\migration\\command\\migrate\\create", "Think\\migration\\command\\migrate\\run", " think\\migration\\command\\migrate\\rollback", "Think\\migration\\command\\migrate\\status", " Think\\migration\\command\\seed\\create ", " Think\\migration\\command\\seed\\run ",];? >
Note that because think-migration is stored in Thinkphp/vendor, vendor should be added to the think in Auoload
require __dir__. ' /.. /thinkphp/vendor/autoload.php ';
Two: command line run
Enter PHP think on the command line to see
Migrate: Database Migration Tool Seed: Database Fill tool
Main discussion Migrate:
Migrate:create: Create a new data migration class, PHP think Migrate:create <file>
forexample:php think migrate:create scproductimage file will generate a PHP file in the development directory
***********************************************************
Migrate:run: Complete Data Migration work PHP think Migrate:run
***********************************************************
Migrate:status: View migrate working status PHP think Migrate:status
***********************************************************************************************
Migrate:rollback: Rollback data to a specified data migration version PHP think Migrate:rollback-t <timeline>
<timeline> is the value of the red box above us
Three: Migrate file preparation
There are three methods in migrate
Up: Executed at Migrate:run (provided there is no change method in the file)
Down: Executed at Migrate:rollback (provided there is no change method in the file)
Change:migrate:run and Migrate:rollback (if the method is present, does not go up and down)
THINKPHP5 Data Migration (think-migration)