The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

migrate-database-schema - Install, remove, upgrade, or downgrade a schema

SYNOPSIS

  migrate-database-schema
    --dsn=DBI:string [--user=username] [--pass=password]
    [--desired-version=version|--info|--delete [--full]]
    [--dir=/path/to/schema/files] [--force-current-version=version]
    schema [schema [schema ... ]]

DESCRIPTION

migrate-database-schema allows you to manage database schemas that have been installed by DBIx::Migration::Directories. Using this script, you can view information on your installed schemas, install new schemas, and upgrade/downgrade/remove existing schemas.

OPTIONS

A list of database schema names is specified on the command line, along with some of the following options:

--dsn=string

DBI's Data Source Name (DSN) to use when connecting to the database. Typical examples are 'DBI:mysql:database=test' or 'DBI:SQLite2:/my/database/file'.

This option is required, unless the DBI_DSN environment variable is set (See DBI).

--user

Username to connect to the database with, if required by your database.

--pass

Password to connect to the database with, if required by your database.

--info

Display information about the schemas. If no schema names are specified on the commandline, information about all currently installed schemas is returned.

--delete

Delete the specified schemas.

--full

When deleting specified schemas, also delete the DBIx-Migration-Directories schema if no other schemas are using it.

--desired-version=number

Instead of attempting to upgrade to the latest version, upgrade (or downgrade) us to the specified version.

--force-current-version=number

Ignore what the database says, assume the current schema version is number. This is mostly useful with MySQL databases, since they are incapable of rolling back DDL changes if a migration fails. If this happens in MySQL and you need to "roll back", make sure you have a well-written backwards migration (eg; "DROP TABLE IF EXISTS" instead of "DROP TABLE") and use the arguments, "--force-current-version=[new.version] --desired-version=[old.version]"

--verbose

Explain our actions as we take them.

--help

Display usage synopsis and exit.

SEE ALSO

DBIx::Migration::Directories, DBI