mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 22:28:47 -04:00
handle other kinds of deferrable
This commit is contained in:
parent
9f54d4eba1
commit
128d379a0d
1 changed files with 8 additions and 4 deletions
|
@ -551,7 +551,7 @@ my $DEFERRABLE_RE = qr/
|
||||||
|
|
|
|
||||||
match \s* (?:\S+|".+?(?<!")")
|
match \s* (?:\S+|".+?(?<!")")
|
||||||
) \s*)*
|
) \s*)*
|
||||||
((?:not)? \s* deferrable)?
|
((?:not)? \s* deferrable (?: \s* initially \s* (?: immediate | deferred))?)?
|
||||||
/sxi;
|
/sxi;
|
||||||
|
|
||||||
sub foreign_key_info {
|
sub foreign_key_info {
|
||||||
|
@ -638,6 +638,7 @@ sub foreign_key_info {
|
||||||
}
|
}
|
||||||
|
|
||||||
# cribbed from DBIx::Class::Schema::Loader::DBI::SQLite
|
# cribbed from DBIx::Class::Schema::Loader::DBI::SQLite
|
||||||
|
# but with additional parsing of which kind of deferrable
|
||||||
REL: for my $relid (keys %relid2rels) {
|
REL: for my $relid (keys %relid2rels) {
|
||||||
my $rel = $rels[$relid];
|
my $rel = $rels[$relid];
|
||||||
my $deferrable = $DBI_code_for_rule{'NOT DEFERRABLE'};
|
my $deferrable = $DBI_code_for_rule{'NOT DEFERRABLE'};
|
||||||
|
@ -662,9 +663,12 @@ sub foreign_key_info {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($deferrable_clause) {
|
if ($deferrable_clause) {
|
||||||
$deferrable = $deferrable_clause =~ /not/i
|
# default is already NOT
|
||||||
? $DBI_code_for_rule{'NOT DEFERRABLE'}
|
if ($deferrable_clause !~ /not/i) {
|
||||||
: $DBI_code_for_rule{'INITIALLY IMMEDIATE'};
|
$deferrable = $deferrable_clause =~ /deferred/i
|
||||||
|
? $DBI_code_for_rule{'INITIALLY DEFERRED'}
|
||||||
|
: $DBI_code_for_rule{'INITIALLY IMMEDIATE'};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$_->{DEFERRABILITY} = $deferrable for @{ $relid2rels{$relid} };
|
$_->{DEFERRABILITY} = $deferrable for @{ $relid2rels{$relid} };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue