diff --git a/t/99dbic_sqlt_parser.t b/t/99dbic_sqlt_parser.t index 2ab43a33e..f2ac4ca72 100644 --- a/t/99dbic_sqlt_parser.t +++ b/t/99dbic_sqlt_parser.t @@ -125,6 +125,15 @@ my $idx_exceptions = { my $idx_test = join("\x00", $index->fields); isnt ( $pk_test, $idx_test, "no additional index for the primary columns exists in $source_name"); } + + my $deferrables = grep { + $_->name eq 'track_cd_position' + and $_->type eq 'UNIQUE' + and $_->deferrable == 1 + } + get_table($sqlt_schema, $schema, 'Track')->get_constraints; + + is ($deferrables, 1, "a deferrable unique constraint called track_cd_position exists on Track"); } } diff --git a/t/lib/DBICTest/Schema/Track.pm b/t/lib/DBICTest/Schema/Track.pm index ef3b14de4..2787a7e9c 100644 --- a/t/lib/DBICTest/Schema/Track.pm +++ b/t/lib/DBICTest/Schema/Track.pm @@ -44,7 +44,10 @@ __PACKAGE__->add_columns( ); __PACKAGE__->set_primary_key('trackid'); -__PACKAGE__->add_unique_constraint([ qw/cd position/ ]); +__PACKAGE__->add_unique_constraint({ + columns => [ qw/cd position/ ], + sqlt_extra => { deferrable => 1 } +}); __PACKAGE__->add_unique_constraint([ qw/cd title/ ]); __PACKAGE__->position_column ('position');