bug 2874 [1/3]: schema changes for overriding blocked renewals

Two new subpermissions of circulate were added:
- circulate_remaining_permissions
- override_renewals

Also, the following schema alterations were made
- permissions.code      : varchar(30) => varchar(64)
- user_permissions.code : varchar(30) => varchar(64)

  (The reason for this was because "circulate_remaining_permissions"
   was greater than 30 characters long and wouldn't fit.)

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
John Beppu 2008-12-22 11:07:53 -06:00 committed by Galen Charlton
parent 7a9658cddc
commit fe5cc9933f
5 changed files with 16 additions and 3 deletions

View file

@ -1,4 +1,6 @@
INSERT INTO permissions (module_bit, code, description) VALUES
( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'),
( 1, 'override_renewals', 'Override blocked renewals'),
(13, 'edit_news', 'Write news for the OPAC and staff interfaces'),
(13, 'label_creator', 'Create printable labels and barcodes from catalog and patron data'),
(13, 'edit_calendar', 'Define days when the library is closed'),

View file

@ -1,4 +1,6 @@
INSERT INTO permissions (module_bit, code, description) VALUES
( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions'),
( 1, 'override_renewals', 'Override blocked renewals'),
(13, 'edit_news', 'Write news for the OPAC and staff interfaces'),
(13, 'label_creator', 'Create printable labels and barcodes from catalog and patron data'),
(13, 'edit_calendar', 'Define days when the library is closed'),

View file

@ -2153,7 +2153,7 @@ CREATE TABLE language_script_mapping (
DROP TABLE IF EXISTS `permissions`;
CREATE TABLE `permissions` (
`module_bit` int(11) NOT NULL DEFAULT 0,
`code` varchar(30) DEFAULT NULL,
`code` varchar(64) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
PRIMARY KEY (`module_bit`, `code`),
CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`)
@ -2173,7 +2173,7 @@ DROP TABLE IF EXISTS `user_permissions`;
CREATE TABLE `user_permissions` (
`borrowernumber` int(11) NOT NULL DEFAULT 0,
`module_bit` int(11) NOT NULL DEFAULT 0,
`code` varchar(30) DEFAULT NULL,
`code` varchar(64) DEFAULT NULL,
CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY (`module_bit`, `code`) REFERENCES `permissions` (`module_bit`, `code`)

View file

@ -2113,6 +2113,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
$DBversion = "3.01.00.009";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("ALTER TABLE permissions MODIFY `code` varchar(64) DEFAULT NULL");
$dbh->do("ALTER TABLE user_permissions MODIFY `code` varchar(64) DEFAULT NULL");
$dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions')");
$dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'override_renewals', 'Override blocked renewals')");
print "Upgrade to $DBversion done (added subpermissions for circulate permission)\n";
SetVersion ($DBversion);
}
=item DropAllForeignKeys($table)

View file

@ -10,7 +10,7 @@
use strict;
sub kohaversion {
our $VERSION = '3.01.00.008';
our $VERSION = '3.01.00.009';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install