Dave Rolsky > Pg-DatabaseManager > Pg::DatabaseManager::TestMigrations

Download:
Pg-DatabaseManager-0.05.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.05   Source  

NAME ^

Pg::DatabaseManager::TestMigrations - Test your database migrations

VERSION ^

version 0.05

SYNOPSIS ^

  use Pg::DatabaseManager::TestMigrations qw( test_migrations );
  use Test::More;

  test_migrations(
      min_version      => 3,
      max_version      => 6,
      sql_file_pattern => 't/schemas/MyApp.sql.v%{version}',
  );

  done_testing();

DESCRIPTION ^

This module provides a single exportable subroutine for testing migrations.

SUBROUTINES ^

This module provides one exportable subroutine, test_migrations:

test_migrations( ... )

This subroutine will test your migrations. It requires a number of parameters:

You can also pass any parameter that the database manager class accepts, such as username, password, db_encoding, etc.

HOW IT WORKS ^

The tests are done by creating each version of the database from scratch, using the appropriate SQL file, then dumping the resulting database with pg_dump. Then the code recreates each version and runs the migrations from that version to the max version, comparing the output of pg_dump after each migration.

It uses Test::Differences to compare the dumped databases.

BUGS ^

See Pg::DatabaseManager for details on reporting bugs.

AUTHOR ^

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2011 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)
syntax highlighting: