Adds support for running migrations against a MySql database.
A command line tool that supports database migration management
mysqlmi [options] command
create - Generates a stub migration in the specified directory
run - Executes all pending database migrations located in the specified directory
revert - Reverts the last successfully run migration
directory - The directory that contains the migrations
-h, --help Display this help message
-n, --name The name of the migration to create
Create a connection.php file in your working directory that returns an instance of PDO.
Specify the directory containing the migrations when running the run - or create command.
If a directory is not supplied, the script will use a migrations folder in the working directory.
"Migration" and a 13 digit timestamp will be prepended to the filename.
For example, mysqlmi --name CreateProductTable create ./migrations
will generate a file named Migration1764993752674CreateProductTable.php
in the migrations folder.
mysqlmi --name CreateProductTable create ./migrations
mysqlmi run ./migrations
mysqlmi revert