Bug 20472: Make DB rev idempotent

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-07-12 13:52:02 +02:00
parent f77fd6c993
commit 2de4f55ea5

View file

@ -1,9 +1,16 @@
$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
$dbh->do(q|
ALTER TABLE article_requests
ADD COLUMN `format` enum('PHOTOCOPY', 'SCAN') NOT NULL DEFAULT 'PHOTOCOPY' AFTER notes,
ADD COLUMN `urls` MEDIUMTEXT AFTER format
|);
unless ( column_exists('article_requests', 'format') ) {
$dbh->do(q|
ALTER TABLE article_requests
ADD COLUMN `format` enum('PHOTOCOPY', 'SCAN') NOT NULL DEFAULT 'PHOTOCOPY' AFTER notes
|);
}
unless ( column_exists('article_requests', 'urls') ) {
$dbh->do(q|
ALTER TABLE article_requests
ADD COLUMN `urls` MEDIUMTEXT AFTER format
|);
}
NewVersion( $DBversion, 20472, "Add columns format and urls in article_requests table");
}