shevaua / db-mysql-migrations
There is no license information available for the latest version (v1.0.0) of this package.
DB migrations for mysql
v1.0.0
2019-07-24 06:44 UTC
Requires
- php: ^7.1
- ext-mysqli: ^7.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.15
- phpunit/phpunit: ^7.5
- squizlabs/php_codesniffer: ^3.4
This package is auto-updated.
Last update: 2025-05-25 08:48:20 UTC
README
-
You need an array with configuration params. Ex: /config/sample.php
$params = [ 'folder' => 'path_to_folder', 'ignore' => [ // list of ignored subpathes ], ... ];
-
Create a config instance like this one
$config = new Shevaua\DB\Mysql\Migrations\Config($params);
-
Create a controller instance
$controller = new Shevaua\DB\Mysql\Migrations\MigrationController($config);
-
Let's start
/** Execute all new migrations */ $controller->migrate(); /** Rollback for one step back */ $controller->rollback();
Migration table
Migration table contains next columns:
- id: int
- group: int
- name: varchar
- migrated_at: timestamp
Advanced
There is a way to migrate/rollback migrations step by step
/** Execute all new migrations */
$controller->migrate($limit = 1);
/** Rollback for one step back */
$controller->rollback($limit = 1);