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({
script_directory => $sql_dir,
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({
script_directory => $sql_dir,
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({
script_directory => $sql_dir,
DOWN2: {
use_ok 'DBICVersion_v4';
- my $s = DBICVersion::Schema->connect(@connection);
- $DBICVersion::Schema::VERSION = 2;
- ok($s, 'DBICVersion::Schema 2 instantiates correctly');
+ my $s_old = DBICVersion::Schema3->connect(@connection);
+ my $s_new = DBICVersion::Schema4->connect(@connection);
+ $DBICVersion::Schema4::VERSION = 2;
+ ok($s_new, 'DBICVersion::Schema 2 instantiates correctly');
my $handler = DH->new({
script_directory => $sql_dir,
- schema => $s,
+ schema => $s_new,
databases => 'SQLite',
});
ok($handler, 'DBIx::Class::DeploymentHandler w/2 instantiates correctly');
- my $version = $s->schema_version();
+ my $version = $s_new->schema_version();
$handler->prepare_downgrade({ from_version => 3, to_version => $version });
lives_ok {
- $s->resultset('Foo')->create({
+ $s_old->resultset('Foo')->create({
bar => 'frew',
baz => 'frew',
biff => 'frew',
} 'schema at version 3';
$handler->downgrade;
dies_ok {
- $s->resultset('Foo')->create({
+ $s_old->resultset('Foo')->create({
bar => 'frew',
baz => 'frew',
biff => 'frew',
})
} 'schema not at version 3';
lives_ok {
- $s->resultset('Foo')->create({
+ $s_new->resultset('Foo')->create({
bar => 'frew',
baz => 'frew',
})
-package DBICVersion::Foo;
+package DBICVersion::Foo1;
use base 'DBIx::Class::Core';
use strict;
__PACKAGE__->set_primary_key('foo');
-package DBICVersion::Schema;
+package DBICVersion::Schema1;
use base 'DBIx::Class::Schema';
use strict;
use warnings;
our $VERSION = '1.0';
-__PACKAGE__->register_class('Foo', 'DBICVersion::Foo');
+__PACKAGE__->register_class('Foo', 'DBICVersion::Foo1');
__PACKAGE__->load_components('DeploymentHandler::VersionStorage::Standard::Component');
1;
-package DBICVersion::Foo;
+package DBICVersion::Foo2;
use base 'DBIx::Class::Core';
use strict;
__PACKAGE__->table('Foo');
__PACKAGE__->add_columns(
- foo => {
- data_type => 'INTEGER',
- is_auto_increment => 1,
- },
- bar => {
- data_type => 'VARCHAR',
- size => '10'
- },
- baz => {
- data_type => 'VARCHAR',
- size => '10',
- is_nullable => 1,
- },
+ foo => {
+ data_type => 'INTEGER',
+ is_auto_increment => 1,
+ },
+ bar => {
+ data_type => 'VARCHAR',
+ size => '10'
+ },
+ baz => {
+ data_type => 'VARCHAR',
+ size => '10',
+ is_nullable => 1,
+ },
+ doomed => {
+ data_type => 'VARCHAR',
+ size => '10',
+ is_nullable => 1,
+ },
);
__PACKAGE__->set_primary_key('foo');
-package DBICVersion::Schema;
+package DBICVersion::Schema2;
use base 'DBIx::Class::Schema';
use strict;
use warnings;
our $VERSION = '2.0';
-__PACKAGE__->register_class('Foo', 'DBICVersion::Foo');
+__PACKAGE__->register_class('Foo', 'DBICVersion::Foo2');
__PACKAGE__->load_components('DeploymentHandler::VersionStorage::Standard::Component');
1;
-package DBICVersion::Foo;
+package DBICVersion::Foo3;
use base 'DBIx::Class::Core';
use strict;
__PACKAGE__->set_primary_key('foo');
-package DBICVersion::Schema;
+package DBICVersion::Schema3;
use base 'DBIx::Class::Schema';
use strict;
use warnings;
our $VERSION = '3.0';
-__PACKAGE__->register_class('Foo', 'DBICVersion::Foo');
+__PACKAGE__->register_class('Foo', 'DBICVersion::Foo3');
__PACKAGE__->load_components('DeploymentHandler::VersionStorage::Standard::Component');
1;
-package DBICVersion::Foo;
+package DBICVersion::Foo4;
use base 'DBIx::Class::Core';
use strict;
__PACKAGE__->set_primary_key('foo');
-package DBICVersion::Schema;
+package DBICVersion::Schema4;
use base 'DBIx::Class::Schema';
use strict;
use warnings;
our $VERSION = '2.0';
-__PACKAGE__->register_class('Foo', 'DBICVersion::Foo');
+__PACKAGE__->register_class('Foo', 'DBICVersion::Foo4');
__PACKAGE__->load_components('DeploymentHandler::VersionStorage::Standard::Component');
1;