Bug 24606: DBRev 22.06.00.083
[koha.git] / installer / data / mysql / db_revs / 220600083.pl
1 use Modern::Perl;
2
3 return {
4     bug_number => "24606",
5     description => "Add new table item_editor_templates",
6     up => sub {
7         my ($args) = @_;
8         my ($dbh, $out) = @$args{qw(dbh out)};
9
10         unless( TableExists( 'item_editor_templates' ) ) {
11             $dbh->do(q{
12                 CREATE TABLE `item_editor_templates` (
13                   `id` INT(11) NOT NULL auto_increment COMMENT "id for the template",
14                   `patron_id` int(11) DEFAULT NULL COMMENT "creator of this template",
15                   `name` MEDIUMTEXT NOT NULL COMMENT "template name",
16                   `is_shared` TINYINT(1) NOT NULL DEFAULT 0 COMMENT "controls if template is shared",
17                   `contents` LONGTEXT NOT NULL COMMENT "json encoded template data",
18                   PRIMARY KEY  (`id`),
19                   CONSTRAINT `bn` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
20                 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
21             });
22
23             $dbh->do(q{
24                 INSERT IGNORE INTO permissions (module_bit, code, description) VALUES
25                 ( 9, 'manage_item_editor_templates', 'Update and delete item editor template owned by others');
26             });
27         }
28     },
29 };