Bug 18228: DBRev 17.05.00.002
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
60e55c857c
commit
520d1acac8
2
Koha.pm
2
Koha.pm
|
|
@ -29,7 +29,7 @@ use vars qw{ $VERSION };
|
|||
# - #4 : the developer version. The 4th number is the database subversion.
|
||||
# used by developers when the database changes. updatedatabase take care of the changes itself
|
||||
# and is automatically called by Auth.pm when needed.
|
||||
$VERSION = "17.06.00.001";
|
||||
$VERSION = "17.06.00.002";
|
||||
|
||||
sub version {
|
||||
return $VERSION;
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
$DBversion = 'XXX'; # will be replaced by the RM
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
# Add the new columns
|
||||
$dbh->do(
|
||||
q|ALTER TABLE virtualshelves
|
||||
ADD COLUMN allow_change_from_owner tinyint(1) default 1,
|
||||
ADD COLUMN allow_change_from_others tinyint(1) default 0|
|
||||
);
|
||||
|
||||
# Conversion:
|
||||
# Since we had no readonly lists, change_from_owner is set to true.
|
||||
# When adding or delete_other was granted, change_from_others is true.
|
||||
# Note: In my opinion the best choice; there is no exact match.
|
||||
$dbh->do(
|
||||
q|UPDATE virtualshelves
|
||||
SET allow_change_from_owner = 1,
|
||||
allow_change_from_others = CASE WHEN allow_add=1 OR allow_delete_other=1 THEN 1 ELSE 0 END|
|
||||
);
|
||||
|
||||
# Remove the old columns
|
||||
$dbh->do(
|
||||
q|ALTER TABLE virtualshelves
|
||||
DROP COLUMN allow_add,
|
||||
DROP COLUMN allow_delete_own,
|
||||
DROP COLUMN allow_delete_other|
|
||||
);
|
||||
|
||||
SetVersion( $DBversion );
|
||||
print "Upgrade to $DBversion done (Bug 18228 - Alter table virtualshelves)\n";
|
||||
}
|
||||
|
|
@ -14541,6 +14541,39 @@ if( CheckVersion( $DBversion ) ) {
|
|||
print "Upgrade to $DBversion done (Bug 8612 - Add new column export_format.used_for)\n";
|
||||
}
|
||||
|
||||
$DBversion = '17.06.00.002';
|
||||
if ( CheckVersion($DBversion) ) {
|
||||
|
||||
unless ( column_exists('virtualshelves', 'allow_change_from_owner' ) ) {
|
||||
$dbh->do(q|
|
||||
ALTER TABLE virtualshelves
|
||||
ADD COLUMN allow_change_from_owner tinyint(1) default 1,
|
||||
ADD COLUMN allow_change_from_others tinyint(1) default 0
|
||||
|);
|
||||
|
||||
# Conversion:
|
||||
# Since we had no readonly lists, change_from_owner is set to true.
|
||||
# When adding or delete_other was granted, change_from_others is true.
|
||||
# Note: In my opinion the best choice; there is no exact match.
|
||||
$dbh->do(q|
|
||||
UPDATE virtualshelves
|
||||
SET allow_change_from_owner = 1,
|
||||
allow_change_from_others = CASE WHEN allow_add=1 OR allow_delete_other=1 THEN 1 ELSE 0 END
|
||||
|);
|
||||
|
||||
# Remove the old columns
|
||||
$dbh->do(q|
|
||||
ALTER TABLE virtualshelves
|
||||
DROP COLUMN allow_add,
|
||||
DROP COLUMN allow_delete_own,
|
||||
DROP COLUMN allow_delete_other
|
||||
|);
|
||||
}
|
||||
|
||||
SetVersion($DBversion);
|
||||
print "Upgrade to $DBversion done (Bug 18228 - Alter table virtualshelves to simplify permissions)\n";
|
||||
}
|
||||
|
||||
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
|
||||
# SEE bug 13068
|
||||
# if there is anything in the atomicupdate, read and execute it.
|
||||
|
|
|
|||
Loading…
Reference in New Issue