9 use DBIx::Class::DeploymentHandler;
10 use DBIx::Class::DeploymentHandler::VersionHandler::ExplicitVersions;
11 my $db = 'dbi:SQLite:db.db';
12 my @connection = ($db, '', '', { ignore_version => 1 });
13 my $sql_dir = 't/sql';
18 my $s = DBICVersion::Schema->connect(@connection);
20 my $handler = DBIx::Class::DeploymentHandler->new({
21 upgrade_directory => $sql_dir,
23 databases => 'SQLite',
24 sqltargs => { add_drop_table => 0 },
26 my $v_storage = $handler->version_storage;
27 my $version = $s->schema_version();
28 $handler->prepare_install();
32 my $vh = DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions->new({
34 ordered_versions => $versions,
36 version_storage => $v_storage,
39 ok( $vh, 'VersionHandler gets instantiated' );
40 ok( eq_array( $vh->next_version_set, [qw( 1.0 5.0 )] ), 'db version and to_version get correctly put into version set');
41 ok( !$vh->next_version_set, 'next_version_set only works once');
42 ok( !$vh->next_version_set, 'seriously.');
46 my $vh = DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions->new({
48 ordered_versions => $versions,
49 version_storage => $v_storage,
52 ok( $vh, 'VersionHandler gets instantiated' );
53 ok( !$vh->next_version_set, 'VersionHandler is null when schema_version and db_verison are the same' );
57 my $vh = DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions->new({
59 ordered_versions => $versions,
60 version_storage => $v_storage,
63 ok( $vh, 'VersionHandler gets instantiated' );
64 ok( !$vh->next_version_set, 'VersionHandler is null when schema_version and db_verison are the same' );
68 $DBICVersion::Schema::VERSION = '10.0';
70 my $vh = DBIx::Class::DeploymentHandler::VersionHandler::DatabaseToSchemaVersions->new({
72 ordered_versions => $versions,
73 version_storage => $v_storage,
76 ok( $vh, 'VersionHandler gets instantiated' );
77 ok( eq_array( $vh->next_version_set, [qw( 1.0 10.0 )] ), 'db version and schema version get correctly put into version set');
78 ok( !$vh->next_version_set, 'VersionHandler is null on next try' );
84 vim: ts=2 sw=2 expandtab