my $s = My::Schema->connect(...);
my $dh = DH->new({
- schema => $s,
- databases => 'SQLite',
- sqltargs => { add_drop_table => 0 },
+ schema => $s,
+ databases => 'SQLite',
+ sql_translator_args => { add_drop_table => 0 },
});
$dh->prepare_install;
my $s = My::Schema->connect(...);
my $dh = DH->new({
- schema => $s,
- databases => 'SQLite',
- sqltargs => { add_drop_table => 0 },
+ schema => $s,
+ databases => 'SQLite',
+ sql_translator_args => { add_drop_table => 0 },
});
$dh->prepare_upgrade(1, 2);
$s
}
-has sqltargs => (
+has sql_translator_args => (
isa => 'HashRef',
is => 'ro',
default => sub { {} },
sub _prepare_install {
my $self = shift;
- my $sqltargs = { %{$self->sqltargs}, %{shift @_} };
+ my $sqltargs = { %{$self->sql_translator_args}, %{shift @_} };
my $to_file = shift;
my $schema = $self->schema;
my $databases = $self->databases;
my $schema = $self->schema;
my $databases = $self->databases;
my $dir = $self->upgrade_directory;
- my $sqltargs = $self->sqltargs;
+ my $sqltargs = $self->sql_translator_args;
my $schema_version = $self->schema_version;
The L<DBIx::Class::Storage> that is I<actually> used to talk to the database
and generate the DDL. This is automatically created with L</_build_storage>.
-=attr sqltargs
+=attr sql_translator_args
-TODO
-# rename
+The arguments that get passed to L<SQL::Translator> when it's used.
=attr upgrade_directory
default => sub { [qw( MySQL SQLite PostgreSQL )] },
);
-has sqltargs => (
+has sql_translator_args => (
isa => 'HashRef',
is => 'ro',
default => sub { {} },
sub _build_deploy_method {
my $self = shift;
DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated->new({
- schema => $self->schema,
- databases => $self->databases,
- upgrade_directory => $self->upgrade_directory,
- sqltargs => $self->sqltargs,
+ schema => $self->schema,
+ databases => $self->databases,
+ upgrade_directory => $self->upgrade_directory,
+ sql_translator_args => $self->sql_translator_args,
});
}
default => sub { [qw( MySQL SQLite PostgreSQL )] },
);
-has sqltargs => (
+has sql_translator_args => (
isa => 'HashRef',
is => 'ro',
default => sub { {} },
sub _build_deploy_method {
my $self = shift;
my $args = {
- schema => $self->schema,
- databases => $self->databases,
- upgrade_directory => $self->upgrade_directory,
- sqltargs => $self->sqltargs,
+ schema => $self->schema,
+ databases => $self->databases,
+ upgrade_directory => $self->upgrade_directory,
+ sql_translator_args => $self->sql_translator_args,
};
$args->{schema_version} = $self->schema_version if $self->has_schema_version;
upgrade_directory => $sql_dir,
schema => $s,
databases => 'SQLite',
- sqltargs => { add_drop_table => 0 },
+ sql_translator_args => { add_drop_table => 0 },
});
ok($handler, 'DBIx::Class::DeploymentHandler w/1 instantiates correctly');
upgrade_directory => $sql_dir,
schema => $s,
databases => 'SQLite',
- sqltargs => { add_drop_table => 0 },
+ sql_translator_args => { add_drop_table => 0 },
});
ok($handler, 'DBIx::Class::DeploymentHandler w/1.0 instantiates correctly');
schema => $s,
upgrade_directory => $sql_dir,
databases => ['SQLite'],
- sqltargs => { add_drop_table => 0 },
+ sql_translator_args => { add_drop_table => 0 },
});
ok( $dm, 'DBIC::DH::DM::SQL::Translator gets instantiated correctly' );
schema => $s,
upgrade_directory => $sql_dir,
databases => ['SQLite'],
- sqltargs => { add_drop_table => 0 },
+ sql_translator_args => { add_drop_table => 0 },
txn_wrap => 1,
});
schema => $s,
upgrade_directory => $sql_dir,
databases => ['SQLite'],
- sqltargs => { add_drop_table => 0 },
+ sql_translator_args => { add_drop_table => 0 },
txn_wrap => 0,
});
schema => $s,
upgrade_directory => $sql_dir,
databases => ['SQLite'],
- sqltargs => { add_drop_table => 0 },
+ sql_translator_args => { add_drop_table => 0 },
});
ok( $dm, 'DBIC::DH::DM::SQLT::Deprecated gets instantiated correctly' );
my $s = DBICVersion::Schema->connect(@connection);
{
- my $warning;
- local $SIG{__WARN__} = sub {$warning = shift};
- my $t = DBICVersion::Schema->connect('frewfrew', '', '');
- like( $warning, qr/Your DB is currently unversioned. Please call upgrade on your schema to sync the DB/, 'warning when database is unversioned');
+ my $warning;
+ local $SIG{__WARN__} = sub {$warning = shift};
+ my $t = DBICVersion::Schema->connect('frewfrew', '', '');
+ like( $warning, qr/Your DB is currently unversioned. Please call upgrade on your schema to sync the DB/, 'warning when database is unversioned');
}
DBICDHTest::ready;
my $dm = Translator->new({
- schema => $s,
- upgrade_directory => $sql_dir,
- databases => ['SQLite'],
- sqltargs => { add_drop_table => 0 },
+ schema => $s,
+ upgrade_directory => $sql_dir,
+ databases => ['SQLite'],
+ sql_translator_args => { add_drop_table => 0 },
});
my $vs = Standard->new({ schema => $s });
$dm->prepare_resultsource_install(
- $vs->version_rs->result_source
+ $vs->version_rs->result_source
);
ok( $vs, 'DBIC::DH::VersionStorage::Standard instantiates correctly' );
ok( !$vs->version_storage_is_installed, 'VersionStorage is not yet installed' );
$dm->install_resultsource(
- $vs->version_rs->result_source,
- '1.0',
+ $vs->version_rs->result_source,
+ '1.0',
);
ok( $vs->version_storage_is_installed, 'VersionStorage is now installed' );
$vs->add_database_version({
- version => '1.0',
+ version => '1.0',
});
ok(
- eq_array(
- [ $vs->version_rs->search(undef, {order_by => 'id'})->get_column('version')->all],
- [ '1.0' ],
- ),
- 'initial version works correctly'
+ eq_array(
+ [ $vs->version_rs->search(undef, {order_by => 'id'})->get_column('version')->all],
+ [ '1.0' ],
+ ),
+ 'initial version works correctly'
);
is( $vs->database_version, '1.0', 'database version is 1.0');
$vs->add_database_version({
- version => '2.0',
+ version => '2.0',
});
is( $vs->database_version, '2.0', 'database version is 2.0');
ok(
- eq_array(
- [ $vs->version_rs->search(undef, {order_by => 'id'})->get_column('version')->all],
- [ '1.0', '2.0', ],
- ),
- 'adding another version works correctly'
+ eq_array(
+ [ $vs->version_rs->search(undef, {order_by => 'id'})->get_column('version')->all],
+ [ '1.0', '2.0', ],
+ ),
+ 'adding another version works correctly'
);
{
- my $warning;
- local $SIG{__WARN__} = sub {$warning = shift};
- my $u = DBICVersion::Schema->connect($db, '', '');
- like( $warning, qr/Versions out of sync. This is 1.0, your database contains version 2.0, please call upgrade on your Schema./, 'warning when database/schema mismatch');
+ my $warning;
+ local $SIG{__WARN__} = sub {$warning = shift};
+ my $u = DBICVersion::Schema->connect($db, '', '');
+ like( $warning, qr/Versions out of sync. This is 1.0, your database contains version 2.0, please call upgrade on your Schema./, 'warning when database/schema mismatch');
}