Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
0e0dfea9
Commit
0e0dfea9
authored
Sep 04, 2018
by
Francesc Guasch
Browse files
feature(upgrade): add indexes to the SQL tables
issue #828
parent
a78bd734
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
0e0dfea9
...
...
@@ -756,6 +756,40 @@ sub _update_data {
$self
->
_update_domain_drivers_options
();
$self
->
_update_old_qemus
();
$self
->
_add_indexes
();
}
sub
_add_indexes
($self) {
return
if
$CONNECTOR
->
dbh
->
{
Driver
}{
Name
}
!~
/mysql/i
;
$self
->
_add_indexes_domains
();
$self
->
_add_indexes_requests
();
}
sub
_add_indexes_domains
($self) {
my
%index
;
my
$sth
=
$CONNECTOR
->
dbh
->
prepare
("
show index from domains
");
$sth
->
execute
;
while
(
my
$row
=
$sth
->
fetchrow_hashref
)
{
$index
{
$row
->
{
Key_name
}}
->
{
$row
->
{
Column_name
}}
++
;
}
return
if
$index
{
id_base_index
};
warn
"
INFO: Adding domains . id_base index
";
$sth
=
$CONNECTOR
->
dbh
->
prepare
("
ALTER TABLE domains add index id_base_index
"
.
"
(id_base)
");
$sth
->
execute
;
}
sub
_add_indexes_requests
($self) {
my
%index
;
my
$sth
=
$CONNECTOR
->
dbh
->
prepare
("
show index from requests
");
$sth
->
execute
;
while
(
my
$row
=
$sth
->
fetchrow_hashref
)
{
$index
{
$row
->
{
Key_name
}}
->
{
$row
->
{
Column_name
}}
++
;
}
return
if
$index
{
domain_status
};
warn
"
INFO: Adding requests . id_domain,status index
";
$sth
=
$CONNECTOR
->
dbh
->
prepare
("
ALTER TABLE requests add index domain_status
"
.
"
(id_domain, status)
");
$sth
->
execute
;
}
sub
_rename_grants
($self) {
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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