make recommended bundle (monotonic)
-run arbitrary perl from migration scripts (tests)
make deploy_version_storage
pod
}
$storage->_query_end($line);
}
- } elsif ( $filename =~ /\.pl$/ ) {
- qx( $^X $filename );
+ } elsif ( $filename =~ /^(.+)\.pl$/ ) {
+ my $package = $1;
+ my $filedata = do { local( @ARGV, $/ ) = $filename; <> };
+ # make the package name more palateable to perl
+ $package =~ s/\W/_/g;
+
+ no warnings 'redefine';
+ eval "package $package;\n\n$filedata";
+ use warnings;
+
+ $package->can('run')->($self->schema);
} else {
croak "A file got to deploy that wasn't sql or perl!";
}
upgrade_directory => $sql_dir,
databases => ['SQLite'],
sqltargs => { add_drop_table => 0 },
+ txn_wrap => 1,
});
ok( $dm, 'DBIC::DH::SQL::Translator w/2.0 instantiates correctly');
print {$common} qq<INSERT INTO Foo (bar, baz) VALUES ("hello", "world");\n\n>;
close $common;
+ open my $common_pl, '>',
+ catfile(qw( t sql _common up 1.0-2.0 003-semiautomatic.pl ));
+ print {$common_pl} q|
+ sub run {
+ my $schema = shift;
+ $schema->resultset('Foo')->create({
+ bar => 'goodbye',
+ baz => 'blue skies',
+ })
+ }
+ |;
+ close $common_pl;
+
$dm->upgrade_single_step([qw( 1.0 2.0 )]);
is( $s->resultset('Foo')->search({
bar => 'hello',
baz => 'world',
})->count, 1, '_common migration got run');
+ is( $s->resultset('Foo')->search({
+ bar => 'goodbye',
+ #baz => 'blue skies',
+ })->count, 1, '_common perl migration got run');
lives_ok {
$s->resultset('Foo')->create({
bar => 'frew',