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
f3fd8389
Commit
f3fd8389
authored
Mar 24, 2017
by
Francesc Guasch
Browse files
[#146] check column for volume target at start
parent
f9df1d7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
f3fd8389
...
...
@@ -85,8 +85,29 @@ sub BUILD {
$self
->
connector
(
$CONNECTOR
);
}
Ravada::Auth::
init
(
$CONFIG
);
$self
->
_upgrade_tables
();
}
sub
_upgrade_table
{
my
$self
=
shift
;
my
(
$table
,
$field
,
$definition
)
=
@_
;
my
$dbh
=
$CONNECTOR
->
dbh
;
my
$sth
=
$dbh
->
column_info
(
undef
,
undef
,
$table
,
$field
);
my
$row
=
$sth
->
fetchrow_hashref
;
$sth
->
finish
;
return
if
$row
;
warn
"
INFO: adding
$field
$definition
to
$table
\n
";
$dbh
->
do
("
alter table
$table
add
$field
$definition
");
}
sub
_upgrade_tables
{
my
$self
=
shift
;
$self
->
_upgrade_table
('
file_base_images
','
target
','
varchar(64) DEFAULT NULL
');
}
sub
_connect_dbh
{
my
$driver
=
(
$CONFIG
->
{
db
}
->
{
driver
}
or
'
mysql
');;
my
$db_user
=
(
$CONFIG
->
{
db
}
->
{
user
}
or
getpwnam
(
$>
));;
...
...
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