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
9dc460f7
Commit
9dc460f7
authored
Jul 03, 2020
by
frankiejol
Browse files
refactor(install): fixed if not exists
parent
7da0eeb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
9dc460f7
...
...
@@ -945,6 +945,9 @@ sub _add_indexes_generic($self) {
"
unique(hostname, vm_type)
"
]
);
my
$if_not_exists
=
'';
$if_not_exists
=
'
IF NOT EXISTS
'
if
$CONNECTOR
->
dbh
->
{
Driver
}{
Name
}
=~
/sqlite|mariadb/i
;
for
my
$table
(
keys
%index
)
{
my
$known
=
$self
->
_get_indexes
(
$table
);
for
my
$change
(
@
{
$index
{
$table
}}
)
{
...
...
@@ -956,7 +959,7 @@ sub _add_indexes_generic($self) {
next
if
$known
->
{
$name
};
$type
.=
"
INDEX
"
if
$type
=~
/^unique/i
;
my
$sql
=
"
CREATE
$type
IF NOT EXISTS
$name
on
$table
(
$fields
)
";
my
$sql
=
"
CREATE
$type
$if_not_exists
$name
on
$table
(
$fields
)
";
warn
"
INFO: Adding index to
$table
:
$name
"
if
$
0
!~
/\.t$/
;
my
$sth
=
$CONNECTOR
->
dbh
->
prepare
(
$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