01/06
2018
Database migration for Skeleton
Migrations for Skeleton. Migrations are used to track database changes., (*1)
Installation via composer:, (*2)
composer require tigron/skeleton-migrate
Set the path for migrations, (*3)
/** * \Skeleton\Database\Migration\Config::$migration_directory is deprecated * Use \Skeleton\Database\Migration\Config::$migration_path instead */ \Skeleton\Database\Migration\Config::$migration_path = $some_very_cool_path;
Choose where you want to store the version, (*4)
\Skeleton\Database\Migration\Config::$version_storage = 'file'; // Version will be stored in db_version json file \Skeleton\Database\Migration\Config::$version_storage = 'database'; // Version will be stored in a database \Skeleton\Database\Migration\Config::$database_table = 'db_version'; // Version will be stored in this database table
Remark:, (*5)
Create new migration, (*6)
skeleton migrate:create <name> skeleton migrate:create <package-name>/<name>
Get status, (*7)
skeleton migrate:status
Run all pending migrations, (*8)
skeleton migrate:up
Run a specific migration (version is not stored in the version file), (*9)
skeleton migrate:run <Ymd_His>