PHP code example of milkme / thinkphp-migration
1. Go to this page and download the library: Download milkme/thinkphp-migration library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
milkme / thinkphp-migration example snippets
// /config/migration.php
use think\facade\Env;
return [
'environments' => [
'default_migration_table' => 'phinxlog',
'default_database' => 'default',
'default' => [
'adapter' => Env::get('database.type', 'mysql'),
'host' => Env::get('database.hostname', '127.0.0.1'),
'name' => Env::get('database.database', ''),
'user' => Env::get('database.username', ''),
'pass' => Env::get('database.password', ''),
'table_prefix' => '',
'port' => Env::get('database.port', '3306'),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci'
] ,
]
];
//app/service.php
return [
'milkme\phinx\MigrationService' ,
] ;
php think migrate:breakpoint --e development
php think migrate:breakpoint --e development --r
php think migrate:create MyNewMigration
php think migrate:rollback --e development
php think migrate:rollback --e development --d 2012
php think migrate:rollback --e development --d 201201
php think migrate:rollback --e development --d 20120103
php think migrate:rollback --e development --d 2012010312
php think migrate:rollback --e development --d 201201031205
php think migrate:rollback ---e development --d 20120103120530
php think seed:create UserSeeder
php think seed:run