5 description => "Add ability to group items on a record",
8 my ($dbh, $out) = @$args{qw(dbh out)};
11 INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
12 ('EnableItemGroups','0','','Enable the item groups feature','YesNo');
16 INSERT IGNORE INTO permissions (module_bit, code, description) VALUES
17 ( 9, 'manage_item_groups', 'Create, update and delete item groups, add or remove items from a item groups');
20 unless ( TableExists('item_groups') ) {
22 CREATE TABLE `item_groups` (
23 `item_group_id` INT(11) NOT NULL auto_increment COMMENT "id for the items group",
24 `biblio_id` INT(11) NOT NULL DEFAULT 0 COMMENT "id for the bibliographic record the group belongs to",
25 `display_order` INT(4) NOT NULL DEFAULT 0 COMMENT "The 'sort order' for item_groups",
26 `description` MEDIUMTEXT default NULL COMMENT "A group description",
27 `created_on` TIMESTAMP NULL COMMENT "Time and date the group was created",
28 `updated_on` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT "Time and date of the latest change on the group",
29 PRIMARY KEY (`item_group_id`),
30 CONSTRAINT `item_groups_ibfk_1` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
31 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
35 unless ( TableExists('item_group_items') ) {
37 CREATE TABLE `item_group_items` (
38 `item_group_items_id` int(11) NOT NULL auto_increment COMMENT "id for the group/item link",
39 `item_group_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key making this table a 1 to 1 join from items to item groups",
40 `item_id` INT(11) NOT NULL DEFAULT 0 COMMENT "foreign key linking this table to the items table",
41 PRIMARY KEY (`item_group_items_id`),
42 UNIQUE KEY (`item_id`),
43 CONSTRAINT `item_group_items_iifk_1` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
44 CONSTRAINT `item_group_items_gifk_1` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE
45 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;