-# replace the sqlt calback with a custom version ading an index
-$schema->source('Track')->sqlt_deploy_callback(sub {
- my ($self, $sqlt_table) = @_;
-
- is (
- $sqlt_table->schema->translator->producer_type,
- join ('::', 'SQL::Translator::Producer', $schema->storage->sqlt_type),
- 'Production type passed to translator object',
- );
+{
+ my $deploy_hook_called = 0;
- if ($schema->storage->sqlt_type eq 'SQLite' ) {
- $sqlt_table->add_index( name => 'track_title', fields => ['title'] )
- or die $sqlt_table->error;
- }
+ # replace the sqlt calback with a custom version ading an index
+ $schema->source('Track')->sqlt_deploy_callback(sub {
+ my ($self, $sqlt_table) = @_;
+
+ $deploy_hook_called = 1;
- $self->default_sqlt_deploy_hook($sqlt_table);
-});
+ is (
+ $sqlt_table->schema->translator->producer_type,
+ join ('::', 'SQL::Translator::Producer', $schema->storage->sqlt_type),
+ 'Production type passed to translator object',
+ );
+
+ if ($schema->storage->sqlt_type eq 'SQLite' ) {
+ $sqlt_table->add_index( name => 'track_title', fields => ['title'] )
+ or die $sqlt_table->error;
+ }
-$schema->deploy; # do not remove, this fires the is() test in the callback above
+ $self->default_sqlt_deploy_hook($sqlt_table);
+ });
+ $schema->deploy; # do not remove, this fires the is() test in the callback above
+ ok($deploy_hook_called, 'deploy hook got called');
+}
my $translator = SQL::Translator->new(