Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
9500dff4
Commit
9500dff4
authored
Feb 01, 2022
by
Francesc Guasch
Browse files
fix: drop constraint if different
parent
b78318e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
9500dff4
...
...
@@ -218,7 +218,7 @@ sub _do_create_constraints($self) {
my
(
$name
)
=
$constraint
=~
/CONSTRAINT (\w+)\s/
;
warn
"
INFO: creating constraint
$name
\n
"
if
!
$FIRST_TIME_RUN
&&
$
0
!~
/\.t$/
;
if
$name
&&
!
$FIRST_TIME_RUN
&&
$
0
!~
/\.t$/
;
print
"
+
"
if
$FIRST_TIME_RUN
&&
!
$CAN_FORK
;
$self
->
_clean_db_leftovers
();
...
...
@@ -2048,6 +2048,12 @@ sub _create_constraints($self, $table, @constraints) {
my
$name
=
"
constraint_
${table}
_
$field
";
next
if
$known
->
{
$name
}
&&
$known
->
{
$name
}
eq
$sql
;
if
(
$known
->
{
$name
})
{
push
@
{
$self
->
{
_constraints
}}
,"
alter table
$table
DROP constraint
$name
";
}
$sql
=
"
alter table
$table
add CONSTRAINT
$name
$sql
";
# $CONNECTOR->dbh->do($sql);
push
@
{
$self
->
{
_constraints
}},(
$sql
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment