#!/usr/bin/env perl
#
# This program uses Test::Database::Migrator to test using Postgres.
#
# This way Test::Database::Migrator exercises both Database::Migrator and
# Database::Migrator::Pg.

package MyMigrator;

use strict;
use warnings;

use Moose;

extends 'Database::Migrator::Pg';

has '+database' => (
    default => 'test',
);

has '+host' => (
    default => '127.0.0.1',
);

has '+port' => (
    default => 5432,
);

has '+username' => (
    default => 'test',
);

has '+password' => (
    default => 'test',
);

has '+verbose' => (
    default => 1,
);

1;

package main;

use strict;
use warnings;

use Test::Database::Migrator ();
use Test::More;
use Try::Tiny qw( catch try );

sub main {
    my $migrator = Test::Database::Migrator->new(
        class => 'MyMigrator',
    );

    $migrator->run_tests;

    done_testing();
    return 1;
}

exit(main() ? 0 : 1);

Add a program to test using Test::Database::Migrator
Add a program to test using Test::Database::Migrator

Currently this depends on Postgres, so running it automatically is not
set up. However it is likely still of some use to maintainers to be able
to use that class without the effort of re-creating something like this.
