Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
mybatis/rails like migration tool for PHP
branch: master

This branch is 88 commits behind alwex:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
README
migrate

README

= PhpDbMigration - full PHP database migration tool =

This is a full standalone PHP tool inspired by the rails database migration tool and MyBatis.
It merge the functionnality of the two tools and has been desined to be as flexible as possible.

== Initialization ==

The first time the tool is run, it needs a first initialization like the following:

./migrate --init --driver=<driver> --database=<database> --host=<host> --login=<db_login> --password=<db_password> --changelog=<changelog_table_name>

Example:

./migrate --init --driver=pgsql --database=php_migration_test --host=localhost --login=my_login --password=my_password --changelog=changelog

wich will create the following directories/files

./environments
     |----development.ini
     |----preproduction.ini
     `----production.ini

./migrations

just edit/change the environment ini files in order to match with your database access.

== Usage ==

Usage: ./migrate command [parameters] [--env=<environment>]

Commands:
  --env=<environment>       Environment to configure. Default environment is 'dev'.
  --generate <description>  Creates a new migration with the provided description.
  --up                      Run unapplied migrations, ALL by default.
  --up=<version>            Run unapplied migrations up to version (included).
  --down                    Undoes migrations applied to the database. ONE by default.
  --down=<version>          Undoes migrations applied to the database. Down to version (included).
  --force                   Run or undoes only specified migration (not recommended).
  --transactional           Rollback all applied migration up or down on error.
  --status                  Show migrations status (applied, unapplied ect...).

Examples:
./migrate [--generate <migration_name>]
./migrate [--up | --up=<version> | --down | --down=<version>] [--transactional] [--force] [--env=<environment>]
./migrate [--status] [--env=<environment>]
Something went wrong with that request. Please try again.