shevaua / db-mysql-migrations
DB migrations for mysql
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/shevaua/db-mysql-migrations
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-10-25 09:49:55 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);