sqltargs => { add_drop_table => 0 },
});
- $dh->prepare_install;
+ $dh->prepare_deploy;
$dh->install;
Deploys the current schema into the database. Populates C<version_storage> with
C<version> and C<ddl>.
-B<Note>: you typically need to call C<< $dh->prepare_install >> before you call
+B<Note>: you typically need to call C<< $dh->prepare_deploy >> before you call
this method.
B<Note>: you cannot install on top of an already installed database
see L<DBIx::Class::DeploymentHandler::HandlesVersionStorage/database_version>
-=head2 prepare_install
+=head2 prepare_deploy
-see L<DBIx::Class::DeploymentHandler::HandlesDeploy/prepare_install>
+see L<DBIx::Class::DeploymentHandler::HandlesDeploy/prepare_deploy>
=head2 prepare_resultsource_install
}, $filename);
}
-sub prepare_install {
+sub prepare_deploy {
my $self = shift;
$self->_prepare_install({}, '_ddl_schema_produce_filename');
}
# ABSTRACT: Interface for deploy methods
-requires 'prepare_install';
+requires 'prepare_deploy';
+requires 'deploy';
+
requires 'prepare_resultsource_install';
requires 'install_resultsource';
+
requires 'prepare_upgrade';
-requires 'prepare_downgrade';
requires 'upgrade_single_step';
+
+requires 'prepare_downgrade';
requires 'downgrade_single_step';
-requires 'deploy';
1;
__END__
-=method prepare_install
-
- (should this be renamed prepare_deploy?)
+=method prepare_deploy
- $dh->prepare_install
+ $dh->prepare_deploy
Generate the needed data files to install the schema to the database.
ok($handler, 'DBIx::Class::DeploymentHandler w/1 instantiates correctly');
my $version = $s->schema_version;
- $handler->prepare_install;
+ $handler->prepare_deploy;
dies_ok {
$s->resultset('Foo')->create({
ok($handler, 'DBIx::Class::DeploymentHandler w/2 instantiates correctly');
my $version = $s->schema_version();
- $handler->prepare_install();
+ $handler->prepare_deploy();
$handler->prepare_upgrade(1, $version);
dies_ok {
$s->resultset('Foo')->create({
ok($handler, 'DBIx::Class::DeploymentHandler w/3 instantiates correctly');
my $version = $s->schema_version();
- $handler->prepare_install;
+ $handler->prepare_deploy;
$handler->prepare_upgrade( 2, $version );
dies_ok {
$s->resultset('Foo')->create({
ok($handler, 'DBIx::Class::DeploymentHandler w/1.0 instantiates correctly');
my $version = $s->schema_version();
- $handler->prepare_install();
+ $handler->prepare_deploy();
dies_ok {
$s->resultset('Foo')->create({
ok($handler, 'DBIx::Class::DeploymentHandler w/2.0 instantiates correctly');
my $version = $s->schema_version();
- $handler->prepare_install();
+ $handler->prepare_deploy();
$handler->prepare_upgrade('1.0', $version);
dies_ok {
$s->resultset('Foo')->create({
ok($handler, 'DBIx::Class::DeploymentHandler w/3.0 instantiates correctly');
my $version = $s->schema_version();
- $handler->prepare_install;
+ $handler->prepare_deploy;
$handler->prepare_upgrade( '2.0', $version );
dies_ok {
$s->resultset('Foo')->create({
ok( $dm, 'DBIC::DH::DM::SQL::Translator gets instantiated correctly' );
- $dm->prepare_install;
+ $dm->prepare_deploy;
{
my $warned = 0;
local $SIG{__WARN__} = sub{$warned = 1};
- $dm->prepare_install;
- ok( $warned, 'prepare_install warns if you run it twice' );
+ $dm->prepare_deploy;
+ ok( $warned, 'prepare_deploy warns if you run it twice' );
}
mkpath(catfile(qw( t sql _common schema 1.0 )));
open my $common, '>',
upgrade_directory => $sql_dir,
databases => ['SQLite'],
sqltargs => { add_drop_table => 0 },
- txn_wrap => 1,
+ txn_wrap => 1,
});
ok( $dm, 'DBIC::DH::SQL::Translator w/2.0 instantiates correctly');
$version = $s->schema_version();
- $dm->prepare_install;
+ $dm->prepare_deploy;
ok(
-f catfile(qw( t sql SQLite schema 2.0 001-auto.sql )),
'2.0 schema gets generated properly'
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',
- })
- }
- |;
+ 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 )]);
ok( $dm, 'DBIC::DH::SQL::Translator w/3.0 instantiates correctly');
$version = $s->schema_version();
- $dm->prepare_install;
+ $dm->prepare_deploy;
ok(
-f catfile(qw( t sql SQLite schema 3.0 001-auto.sql )),
'2.0 schema gets generated properly'
use lib 't/lib';
use DBICDHTest;
use aliased
- 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated';
+ 'DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated';
use File::Spec::Functions;
ok( $dm, 'DBIC::DH::DM::SQLT::Deprecated gets instantiated correctly' );
- $dm->prepare_install;
+ $dm->prepare_deploy;
ok(
-f catfile(qw( t sql DBICVersion-Schema-1.0-SQLite.sql )),
}
VERSION2: {
- use_ok 'DBICVersion_v2';
- my $s = DBICVersion::Schema->connect(@connection);
+ use_ok 'DBICVersion_v2';
+ my $s = DBICVersion::Schema->connect(@connection);
my $dm = Deprecated->new({
schema => $s,
upgrade_directory => $sql_dir,
});
ok(
- $dm,
- 'DBIC::DH::DM::SQLT::Deprecated gets instantiated correctly w/ version 2.0'
- );
+ $dm,
+ 'DBIC::DH::DM::SQLT::Deprecated gets instantiated correctly w/ version 2.0'
+ );
- $version = $s->schema_version;
- $dm->prepare_install;
- $dm->prepare_upgrade('1.0', $version, ['1.0', $version]);
- dies_ok {
- $s->resultset('Foo')->create({
- bar => 'frew',
- baz => 'frew',
- })
- } 'schema not deployed';
- dies_ok {
- $s->resultset('Foo')->create({
- bar => 'frew',
- baz => 'frew',
- })
- } 'schema not uppgrayyed';
- $dm->upgrade_single_step(['1.0', $version]);
- lives_ok {
- $s->resultset('Foo')->create({
- bar => 'frew',
- baz => 'frew',
- })
- } 'schema is deployed';
+ $version = $s->schema_version;
+ $dm->prepare_deploy;
+ $dm->prepare_upgrade('1.0', $version, ['1.0', $version]);
+ dies_ok {
+ $s->resultset('Foo')->create({
+ bar => 'frew',
+ baz => 'frew',
+ })
+ } 'schema not deployed';
+ dies_ok {
+ $s->resultset('Foo')->create({
+ bar => 'frew',
+ baz => 'frew',
+ })
+ } 'schema not uppgrayyed';
+ $dm->upgrade_single_step(['1.0', $version]);
+ lives_ok {
+ $s->resultset('Foo')->create({
+ bar => 'frew',
+ baz => 'frew',
+ })
+ } 'schema is deployed';
}
done_testing;
#vim: ts=2 sw=2 expandtab