Bug 33053: Remove default value for tables item_groups and recalls
[koha.git] / installer / data / mysql / db_revs / 210600038.pl
1 use Modern::Perl;
2
3 return {
4     bug_number => "14957",
5     description => "Add a way to define overlay rules for incoming MARC records",
6     up => sub {
7         my ($args) = @_;
8         my ($dbh, $out) = @$args{qw(dbh out)};
9         unless ( TableExists('marc_overlay_rules') ) {
10             $dbh->do(q{
11                 CREATE TABLE IF NOT EXISTS `marc_overlay_rules` (
12                   `id` int(11) NOT NULL auto_increment,
13                   `tag` varchar(255) NOT NULL, -- can be regexp, so need > 3 chars
14                   `module` varchar(127) NOT NULL,
15                   `filter` varchar(255) NOT NULL,
16                   `add`    TINYINT(1) NOT NULL DEFAULT 0,
17                   `append` TINYINT(1) NOT NULL DEFAULT 0,
18                   `remove` TINYINT(1) NOT NULL DEFAULT 0,
19                   `delete` TINYINT(1) NOT NULL DEFAULT 0,
20                   PRIMARY KEY(`id`)
21                 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
22             });
23
24             say $out "Added new table 'marc_overlay_rules'";
25         }
26
27         $dbh->do(q{
28           INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES (
29             'MARCOverlayRules',
30             '0',
31             NULL,
32             'Use the MARC record overlay rules system to decide what actions to take for each field when modifying records.',
33             'YesNo'
34           );
35         });
36         say $out "Added new system preferences 'MARCOverlayRules'";
37
38         $dbh->do(q{
39           INSERT IGNORE INTO permissions (module_bit, code, description) VALUES (
40             3,
41             'manage_marc_overlay_rules',
42             'Manage MARC overlay rules configuration'
43           );
44         });
45         say $out "Added new permissions 'manage_marc_overlay_rules'";
46     },
47 }