NAME

DBIx::Migration::Pg - Seamless PostgreSQL database schema up- and downgrades

SYNOPSIS

my $m = DBIx::Migration->new(
  dsn            => 'dbi:Pg:dbname=myapp.db;host=localhost;port=5432;user=postgres',
  managed_schema => 'myapp'
);

DESCRIPTION

PostgreSQL supports schemas.

For a PostgreSQL database you may set a managed schema (the schema of your single-schema application). By default the managed schema is public. This class overrides the apply_managed_schema() method. The method assigns the managed schema to the PostgreSQL search_path connect option.

For a PostgreSQL database you may set a tracking schema (the schema of your tracking table) too. By default the tracking schema is public.

ACCESSORS

$self->managed_schema

Get schema that your single-schema application refers to.

$self->tracking_schema

Get schema that the tracking table belongs to.

METHODS

$self->adjust_migrate

Lock tracking table and set managed schema.

$self->quoted_tracking_table

Quote tracking table taking the tracking schema into consideration.

COMPARISONS

There are more PostgreSQL database migration libraries on the CPAN. This chapter tries to compare some of them. The content is work in progress.

|                         | DBIx::Migration                 | App::Sqitch            |
+-------------------------+---------------------------------+------------------------+
| change                  | migration                       | change                 |
| SQL script types        | up, down                        | deploy, revert, verify |
| tracking                | tracking table                  | registry tables        |
| dependency relationship | linear (numbered consecutively) | tree like (requires)   |

SEE ALSO