dev-master
9999999-devDatabase migration scripts for PHP
MIT
The Requires
by David Sveningsson
by Andreas Tarandi
v2.0.0
2.0.0.0Database migration scripts for PHP
MIT
The Requires
by David Sveningsson
by Andreas Tarandi
Database migration scripts for PHP
This is a php-script that helps you handling versions of your database in a format that works well with code versioning., (*1)
This is a fork of torandi/php_migrations with breaking changes., (*2)
update_database
will exit with error codes on any error.--check
is renamed --dry-run
.--config
.getopt-php
instead of custom argument parsing.composer require sidvind/php-migrations
migrations
(or whatever)update_database.php
and create_migration.php
into the directory.config-example.php
to config.php
and edit it to fit your project
(see config-example.php
for more info)Use migrations/create_migration.php migration_name
to create a new migration., (*3)
This creates a empty migration with a name like
20110821231945_migration_name.sql
. The file name (including the date) is the
version name, and must be unique., (*4)
You may also specify a second argument to create_migration to select file format (sql or php):, (*5)
config.php
is
available, remember <?php
and be verbose. Not run in global scope.To then run the migrations execute migrations/update_database.php
which runs
all unrun migrations. The table schema_migrations
are created (if not exist)
containing all run migrations., (*6)
migration_sql(query)
: Print and run queryrun_sql(query)
: Run query in silenceUsage: migrations/update_database.php [options] [<username>] Options: -c, --config <arg> Configuration file to use. Default: "config.php". -h, --help Show this text. -n, --dry-run Only checks if there are migrations to run, won't perform any modifications.
Username may be optional, depending on your config.php, (*7)
Database migration scripts for PHP
MIT
Database migration scripts for PHP
MIT