Commit | Line | Data |
ba99ba44 |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use lib 't/lib'; |
7 | use DBICDHTest; |
8 | use DBIx::Class::DeploymentHandler; |
9 | use aliased 'DBIx::Class::DeploymentHandler', 'DH'; |
10 | |
11 | use File::Path 'remove_tree'; |
12 | use Test::More; |
7b3d00f9 |
13 | use File::Temp 'tempdir'; |
ba99ba44 |
14 | use Test::Exception; |
15 | |
f3b5161e |
16 | my $dbh = DBICDHTest::dbh(); |
ba99ba44 |
17 | my @connection = (sub { $dbh }, { ignore_version => 1 }); |
7b3d00f9 |
18 | my $sql_dir = tempdir( CLEANUP => 1 ); |
ba99ba44 |
19 | |
20 | use_ok 'DBICVersion_v1'; |
21 | my $s = DBICVersion::Schema->connect(@connection); |
22 | $DBICVersion::Schema::VERSION = 1; |
23 | ok($s, 'DBICVersion::Schema 1 instantiates correctly'); |
24 | |
25 | my $dh = DH->new({ |
26 | script_directory => $sql_dir, |
27 | schema => $s, |
28 | databases => 'SQLite', |
29 | sql_translator_args => { add_drop_table => 0 }, |
30 | }); |
31 | |
32 | ok($dh, 'DBIx::Class::DeploymentHandler w/1 instantiates correctly'); |
33 | $dh->prepare_version_storage_install; |
34 | |
35 | |
36 | dies_ok { $s->resultset('__VERSION')->first->version } 'version_storage not installed'; |
37 | $dh->install_version_storage; |
38 | |
39 | $dh->add_database_version( { version => $s->schema_version } ); |
40 | |
41 | lives_ok { $s->resultset('__VERSION')->first->version } 'version_storage installed'; |
42 | |
43 | done_testing; |