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
5b177a4e
Commit
5b177a4e
authored
Jun 28, 2021
by
frankiejol
Browse files
refactor(install): base images and domain instances constraints
parent
f9f24228
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
5b177a4e
...
...
@@ -1792,6 +1792,15 @@ sub _sql_create_tables($self) {
}
]
,
[
file_base_images
=>
{
id
=>
'
integer PRIMARY KEY AUTO_INCREMENT
'
,
id_domain
=>
'
integer NOT NULL references `domains` (`id`) ON DELETE CASCADE
'
,
file_base_img
=>
'
varchar(255) DEFAULT NULL
'
,
target
=>
'
varchar(64) DEFAULT NULL
'
}
]
,
[
volumes
=>
{
id
=>
'
integer PRIMARY KEY AUTO_INCREMENT
',
...
...
@@ -1852,6 +1861,11 @@ sub _clean_db_leftovers($self) {
.
"
( SELECT id FROM domains )
");
;
}
for
my
$table
('
bases_vm
'
,'
domain_instances
')
{
$self
->
_delete_limit
("
FROM
$table
WHERE id_vm NOT IN
"
.
"
( SELECT id FROM vms)
");
;
}
for
my
$table
('
grants_user
')
{
my
$sth_select
=
$dbh
->
prepare
("
SELECT count(*) FROM
$table
WHERE id_user NOT IN
"
.
"
( SELECT id FROM users )
");
...
...
@@ -2097,7 +2111,6 @@ sub _upgrade_tables {
# return if $CONNECTOR->dbh->{Driver}{Name} !~ /mysql/i;
$self
->
_upgrade_table
("
base_xml
",'
xml
','
TEXT
');
$self
->
_upgrade_table
('
file_base_images
','
target
','
varchar(64) DEFAULT NULL
');
$self
->
_upgrade_table
('
vms
','
vm_type
',"
char(20) NOT NULL DEFAULT 'KVM'
");
$self
->
_upgrade_table
('
vms
','
connection_args
',"
text DEFAULT NULL
");
...
...
@@ -2214,6 +2227,11 @@ sub _upgrade_tables {
$self
->
_upgrade_table
('
grants_user
',
'
id_user
',
'
int not null references `users` (`id`) ON DELETE CASCADE
');
$self
->
_upgrade_table
('
bases_vm
','
id_vm
','
int not null references `vms` (`id`) ON DELETE CASCADE
');
$self
->
_upgrade_table
('
bases_vm
','
id_domain
','
int not null references `domains` (`id`) ON DELETE CASCADE
');
$self
->
_upgrade_table
('
domain_instances
','
id_vm
','
int not null references `vms` (`id`) ON DELETE CASCADE
');
$self
->
_upgrade_users_table
();
}
...
...
sql/mysql/file_base_images.sql
deleted
100644 → 0
View file @
f9f24228
CREATE
TABLE
`file_base_images`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`id_domain`
int
(
11
),
`file_base_img`
varchar
(
255
)
DEFAULT
NULL
,
`target`
varchar
(
64
)
DEFAULT
NULL
,
PRIMARY
KEY
(
`id`
)
);
sql/sqlite/file_base_images.sql
deleted
100644 → 0
View file @
f9f24228
CREATE
TABLE
`file_base_images`
(
`id`
integer
NOT
NULL
PRIMARY
KEY
AUTOINCREMENT
,
`id_domain`
integer
,
`file_base_img`
varchar
(
255
)
DEFAULT
NULL
,
`target`
varchar
(
64
)
DEFAULT
NULL
);
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