11 use aliased 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator';
12 use File::Spec::Functions qw(catfile splitdir);
13 use File::Path qw(rmtree mkpath);
14 use File::Temp qw(tempfile tempdir);
16 my $dbh = DBICDHTest::dbh();
17 my @connection = (sub { $dbh }, { ignore_version => 1 });
18 my $sql_dir = tempdir( CLEANUP => 1 );
21 use_ok 'DBICVersion_v1';
22 my $s = DBICVersion::Schema->connect(@connection);
23 my $dm = Translator->new({
25 script_directory => $sql_dir,
26 databases => ['SQLite'],
27 sql_translator_args => { add_drop_table => 0 },
35 use_ok 'DBICVersion_v2';
36 my $s = DBICVersion::Schema->connect(@connection);
37 my $dm = Translator->new({
39 script_directory => $sql_dir,
40 databases => ['SQLite'],
41 sql_translator_args => { add_drop_table => 0 },
46 mkpath(catfile(splitdir($sql_dir), qw(_preprocess_schema upgrade 1.0-2.0 )));
48 catfile(splitdir($sql_dir), qw(_preprocess_schema upgrade 1.0-2.0 003-semiautomatic.pl ));
49 my (undef, $fn) = tempfile(OPEN => 0);
52 open my \$fh, ">", '$fn'
53 if \$_[0]->isa("SQL::Translator::Schema")
54 && \$_[1]->isa("SQL::Translator::Schema");
57 $dm->prepare_upgrade({
58 from_version => '1.0',
60 version_set => [qw(1.0 2.0)]
62 ok -e $fn, 'intermediate script ran with the right args';
63 $dm->upgrade_single_step({ version_set => [qw( 1.0 2.0 )] });
66 #vim: ts=2 sw=2 expandtab