VERSION1: {
use_ok 'DBICVersion_v1';
- my $s = DBICVersion::Schema->connect(@connection);
- $DBICVersion::Schema::VERSION = 1;
+ my $s = DBICVersion::Schema1->connect(@connection);
+ $DBICVersion::Schema1::VERSION = 1;
ok($s, 'DBICVersion::Schema 1 instantiates correctly');
my $handler = DH->new({
ignore_ddl => 1,
VERSION2: {
use_ok 'DBICVersion_v2';
- my $s = DBICVersion::Schema->connect(@connection);
- $DBICVersion::Schema::VERSION = 2;
+ my $s = DBICVersion::Schema2->connect(@connection);
+ $DBICVersion::Schema2::VERSION = 2;
ok($s, 'DBICVersion::Schema 2 instantiates correctly');
my $handler = DH->new({
ignore_ddl => 1,
my $version = $s->schema_version();
$handler->prepare_install;
+#$handler->prepare_upgrade({ from_version => 1, to_version => 2 });
dies_ok {
$s->resultset('Foo')->create({
bar => 'frew',
VERSION3: {
use_ok 'DBICVersion_v3';
- my $s = DBICVersion::Schema->connect(@connection);
- $DBICVersion::Schema::VERSION = 3;
+ my $s = DBICVersion::Schema3->connect(@connection);
+ $DBICVersion::Schema3::VERSION = 3;
ok($s, 'DBICVersion::Schema 3 instantiates correctly');
my $handler = DH->new({
ignore_ddl => 1,
DOWN2: {
use_ok 'DBICVersion_v4';
- my $s = DBICVersion::Schema->connect(@connection);
- $DBICVersion::Schema::VERSION = 2;
+ my $s = DBICVersion::Schema4->connect(@connection);
+ $DBICVersion::Schema4::VERSION = 2;
ok($s, 'DBICVersion::Schema 2 instantiates correctly');
my $handler = DH->new({
ignore_ddl => 1,
$s->resultset('Foo')->create({
bar => 'frew',
baz => 'frew',
- biff => 'frew',
})
} 'schema at version 3';
$handler->downgrade;
VERSION1: {
use_ok 'DBICVersion_v1';
- my $s = DBICVersion::Schema->connect(@connection);
+ my $s = DBICVersion::Schema1->connect(@connection);
is $s->schema_version, '1.0', 'schema version is at 1.0';
ok($s, 'DBICVersion::Schema 1.0 instantiates correctly');
my $handler = Deprecated->new({
VERSION2: {
use_ok 'DBICVersion_v2';
- my $s = DBICVersion::Schema->connect(@connection);
+ my $s = DBICVersion::Schema2->connect(@connection);
is $s->schema_version, '2.0', 'schema version is at 2.0';
ok($s, 'DBICVersion::Schema 2.0 instantiates correctly');
my $handler = Deprecated->new({
VERSION3: {
use_ok 'DBICVersion_v3';
- my $s = DBICVersion::Schema->connect(@connection);
+ my $s = DBICVersion::Schema3->connect(@connection);
is $s->schema_version, '3.0', 'schema version is at 3.0';
ok($s, 'DBICVersion::Schema 3.0 instantiates correctly');
my $handler = Deprecated->new({
VERSION1: {
use_ok 'DBICVersion_v1';
- my $s = DBICVersion::Schema->connect(@connection);
+ my $s = DBICVersion::Schema1->connect(@connection);
$DBICVersion::Schema::VERSION = 1;
ok($s, 'DBICVersion::Schema 1 instantiates correctly');
ok !$s->storage->connected, 'creating schema did not connect';
my $sql_dir = 't/sql';
use_ok 'DBICVersion_v1';
-my $s = DBICVersion::Schema->connect(@connection);
-$DBICVersion::Schema::VERSION = 1;
+my $s = DBICVersion::Schema1->connect(@connection);
+$DBICVersion::Schema1::VERSION = 1;
ok($s, 'DBICVersion::Schema 1 instantiates correctly');
my $dh = DH->new({
VERSION1: {
use_ok 'DBICVersion_v1';
- my $s = DBICVersion::Schema->connect(@connection);
+ my $s = DBICVersion::Schema1->connect(@connection);
my $dm = Translator->new({
schema => $s,
script_directory => $sql_dir,
VERSION2: {
use_ok 'DBICVersion_v2';
- my $s = DBICVersion::Schema->connect(@connection);
+ my $s = DBICVersion::Schema2->connect(@connection);
my $dm = Translator->new({
schema => $s,
script_directory => $sql_dir,
VERSION3: {
use_ok 'DBICVersion_v3';
- my $s = DBICVersion::Schema->connect(@connection);
+ my $s = DBICVersion::Schema3->connect(@connection);
my $dm = Translator->new({
schema => $s,
script_directory => $sql_dir,
biff => 'frew',
})
} 'schema is deployed';
- dies_ok {
- $dm->upgrade_single_step({ version_set => [qw( 2.0 3.0 )] });
- } 'dies when sql dir does not exist';
+ ## This doesn't die now with the SQLT fixes
+ #dies_ok {
+ # $dm->upgrade_single_step({ version_set => [qw( 2.0 3.0 )] });
+ #} 'dies when sql dir does not exist';
+ #
+ $dm->upgrade_single_step({ version_set => [qw( 2.0 3.0 )] });
}
my $stuff_that_ran = do { local( @ARGV, $/ ) = 'stuffthatran'; <> };
VERSION1: {
use_ok 'DBICVersion_v1';
- my $s = DBICVersion::Schema->connect(@connection);
+ my $s = DBICVersion::Schema1->connect(@connection);
my $dm = Deprecated->new({
schema => $s,
script_directory => $sql_dir,
$dm->prepare_deploy;
ok(
- -f catfile(qw( t sql DBICVersion-Schema-1.0-SQLite.sql )),
+ -f catfile(qw( t sql DBICVersion-Schema1-1.0-SQLite.sql )),
'1.0 schema gets generated properly'
);
VERSION2: {
use_ok 'DBICVersion_v2';
- my $s = DBICVersion::Schema->connect(@connection);
+ my $s = DBICVersion::Schema2->connect(@connection);
my $dm = Deprecated->new({
schema => $s,
script_directory => $sql_dir,
VERSION1: {
use_ok 'DBICVersion_v1';
- my $s = DBICVersion::Schema->connect(@connection);
+ my $s = DBICVersion::Schema1->connect(@connection);
my $dm = Translator->new({
schema => $s,
script_directory => $sql_dir,
VERSION2: {
use_ok 'DBICVersion_v2';
- my $s = DBICVersion::Schema->connect(@connection);
+ my $s = DBICVersion::Schema2->connect(@connection);
my $dm = Translator->new({
schema => $s,
script_directory => $sql_dir,
my $dbh = DBI->connect("DBI:mysql:test;mysql_socket=${\$testdb->base_dir}/tmp/mysql.sock",'root','');
use_ok 'DBICVersion_v1';
- $DBICVersion::Schema::VERSION = 1;
- ok my $schema = DBICVersion::Schema->connect(sub { $dbh }),
+ $DBICVersion::Schema1::VERSION = 1;
+ ok my $schema = DBICVersion::Schema1->connect(sub { $dbh }),
'got schema';
ok my $dbic_dh = build_dh($schema),
my $dbh = DBI->connect("DBI:mysql:test;mysql_socket=${\$testdb->base_dir}/tmp/mysql.sock",'root','');
use_ok 'DBICVersion_v2';
- $DBICVersion::Schema::VERSION = 2;
- ok my $schema = DBICVersion::Schema->connect(sub { $dbh }),
+ $DBICVersion::Schema2::VERSION = 2;
+ ok my $schema = DBICVersion::Schema2->connect(sub { $dbh }),
'got schema';
ok my $dbic_dh = build_dh($schema,1),
my $dbh = DBI->connect("DBI:mysql:test;mysql_socket=${\$testdb->base_dir}/tmp/mysql.sock",'root','');
use_ok 'DBICVersion_v2';
- $DBICVersion::Schema::VERSION = 2;
- ok my $schema = DBICVersion::Schema->connect(sub { $dbh }),
+ $DBICVersion::Schema2::VERSION = 2;
+ ok my $schema = DBICVersion::Schema2->connect(sub { $dbh }),
'got schema';
my $dbic_dh = DBIx::Class::DeploymentHandler->new({
VERSION1: {
use_ok 'DBICVersion_v1';
- $DBICVersion::Schema::VERSION = 1;
- ok my $schema = DBICVersion::Schema->connect(sub { $dbh }),
+ $DBICVersion::Schema1::VERSION = 1;
+ ok my $schema = DBICVersion::Schema1->connect(sub { $dbh }),
'got schema';
ok my $dbic_dh = build_dh($schema),
VERSION2: {
use_ok 'DBICVersion_v2';
- $DBICVersion::Schema::VERSION = 2;
- ok my $schema = DBICVersion::Schema->connect(sub { $dbh }),
+ $DBICVersion::Schema2::VERSION = 2;
+ ok my $schema = DBICVersion::Schema2->connect(sub { $dbh }),
'got schema';
ok my $dbic_dh = build_dh($schema,1),
my $perl_run,
">",
catfile('t','share','var','pg-deploy','PostgreSQL', 'deploy', '1', '002-test.pl')
- ) || die "Cannot open: $!";
+ ) || do { $testdb->stop(POSIX::SIGINT); die "Cannot open: $!"};
print $perl_run <<'END';
sub {
my @connection = (sub { $dbh }, { ignore_version => 1 });
my $sql_dir = 't/sql';
-my $s = DBICVersion::Schema->connect(@connection);
+my $s = DBICVersion::Schema1->connect(@connection);
{
my $warning;
local $SIG{__WARN__} = sub {$warning = shift};
- my $t = DBICVersion::Schema->connect('frewfrew', '', '');
+ my $t = DBICVersion::Schema1->connect('frewfrew', '', '');
like( $warning, qr/Your DB is currently unversioned. Please call upgrade on your schema to sync the DB/, 'warning when database is unversioned');
}
{
my $warning;
local $SIG{__WARN__} = sub {$warning = shift};
- $u = DBICVersion::Schema->connect(sub { $dbh });
+ $u = DBICVersion::Schema1->connect(sub { $dbh });
like( $warning, qr/Versions out of sync. This is 1\.0, your database contains version 2\.0, please call upgrade on your Schema\./, 'warning when database/schema mismatch');
}