Revision history for DBIx::Class
+ - Do not attempt to deploy FK constraints pointing to a View
+
0.08114 2009-11-14 17:45:00 (UTC)
- Preliminary support for MSSQL via DBD::ADO
- Fix botched 0.08113 release (invalid tarball)
# support quoting properly to be signaled about this
$table_name = $$table_name if ref $table_name eq 'SCALAR';
- # Its possible to have multiple DBIC sources using the same table
+ # It's possible to have multiple DBIC sources using the same table
next if $tables{$table_name};
$tables{$table_name}{source} = $source;
next unless ref $rel_info->{cond} eq 'HASH';
my $othertable = $source->related_source($rel);
+ next if $othertable->isa('DBIx::Class::ResultSource::View'); # can't define constraints referencing a view
my $rel_table = $othertable->name;
# FIXME - this isn't the right way to do it, but sqlt does not
next unless $fk_constraint;
# Make sure we dont create the same foreign key constraint twice
- my $key_test = join("\x00", @keys);
+ my $key_test = join("\x00", sort @keys);
next if $created_FK_rels{$rel_table}->{$key_test};
if (scalar(@keys)) {
if (! $is_deferrable and $rel_table ne $table_name) {
$tables{$table_name}{foreign_table_deps}{$rel_table}++;
}
-
$table->add_constraint(
type => 'foreign_key',
name => join('_', $table_name, 'fk', @keys),