10 use aliased 'DBIx::Class::DeploymentHandler::VersionStorage::Standard';
13 use DBIx::Class::DeploymentHandler;
14 my $db = 'dbi:SQLite:db.db';
15 my @connection = ($db, '', '', { ignore_version => 1 });
16 my $sql_dir = 't/sql';
18 my $s = DBICVersion::Schema->connect(@connection);
21 my $handler = DBIx::Class::DeploymentHandler->new({
22 upgrade_directory => $sql_dir,
24 databases => 'SQLite',
25 sqltargs => { add_drop_table => 0 },
28 $handler->prepare_install();
30 my $vs = Standard->new({ schema => $s });
32 ok( $vs, 'DBIC::DH::VersionStorage::Standard instantiates correctly' );
34 ok( !$vs->version_storage_is_installed, 'VersionStorage is not yet installed' );
38 ok( $vs->version_storage_is_installed, 'VersionStorage is now installed' );
43 version => $_->version,
45 upgrade_sql => $_->upgrade_sql,
46 }, $vs->version_rs->search(undef, {order_by => 'id'})->all],
52 'initial version works correctly'
55 is( $vs->database_version, '1.0', 'database version is 1.0');
56 $vs->add_database_version({
59 is( $vs->database_version, '2.0', 'database version is 2.0');
63 version => $_->version,
65 upgrade_sql => $_->upgrade_sql,
66 }, $vs->version_rs->search(undef, {order_by => 'id'})->all],
76 'adding another version works correctly'
79 $vs->version_rs->delete;
81 ok( $vs->version_storage_is_installed, 'VersionStorage is still installed even if all versions are deleted' );