isa => 'DBIx::Class::Schema',
is => 'ro',
required => 1,
- handles => [qw( schema_version )],
+ handles => [qw( ddl_filename schema_version )],
);
has upgrade_directory => (
isa => 'Str',
is => 'ro',
required => 1,
- default => 'upgrades',
+ default => 'sql',
);
has backup_directory => (
}
has _filedata => (
- isa => 'Str',
+ isa => 'ArrayRef[Str]',
is => 'rw',
);
use lib 't/lib';
use DBICTest;
use DBIx::Class::DeploymentHandler;
-
+my $db = 'dbi:SQLite:db.db';
my $sql_dir = 't/sql';
VERSION1: {
use_ok 'DBICVersion_v1';
- my $s = DBICVersion::Schema->connect('dbi:SQLite::memory:');
+ my $s = DBICVersion::Schema->connect($db);
ok($s, 'DBICVersion::Schema 1.0 instantiates correctly');
my $handler = DBIx::Class::DeploymentHandler->new({
+ upgrade_directory => $sql_dir,
schema => $s,
});
VERSION2: {
use_ok 'DBICVersion_v2';
- my $s = DBICVersion::Schema->connect('dbi:SQLite::memory:');
+ my $s = DBICVersion::Schema->connect($db);
ok($s, 'DBICVersion::Schema 2.0 instantiates correctly');
my $handler = DBIx::Class::DeploymentHandler->new({
+ upgrade_directory => $sql_dir,
schema => $s,
});
baz => 'frew',
})
} 'schema not deployed';
- $handler->install;
+ #$handler->install('1.0');
+ dies_ok {
+ $s->resultset('Foo')->create({
+ bar => 'frew',
+ baz => 'frew',
+ })
+ } 'schema not uppgrayyed';
+ $handler->upgrade_single_step('1.0', '2.0');
lives_ok {
$s->resultset('Foo')->create({
bar => 'frew',
VERSION3: {
use_ok 'DBICVersion_v3';
- my $s = DBICVersion::Schema->connect('dbi:SQLite::memory:');
+ my $s = DBICVersion::Schema->connect($db);
ok($s, 'DBICVersion::Schema 3.0 instantiates correctly');
my $handler = DBIx::Class::DeploymentHandler->new({
+ upgrade_directory => $sql_dir,
schema => $s,
});
ok(-e 't/sql/DBICVersion-Schema-2.0-3.0-SQLite.sql', 'DDL for migration from 2.0 to 3.0 got created successfully');
dies_ok {
$s->resultset('Foo')->create({
- bar => 'frew',
- baz => 'frew',
- biff => 'frew',
- })
+ bar => 'frew',
+ baz => 'frew',
+ biff => 'frew',
+ })
} 'schema not deployed';
- $handler->install;
+ $handler->upgrade_single_step('2.0', '3.0');
lives_ok {
$s->resultset('Foo')->create({
bar => 'frew',
}
done_testing;
+__END__
+
+vim: ts=2,sw=2,expandtab