View | Details | Raw Unified | Return to bug 38924
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_38924-patron_quotas.pl (-1 / +23 lines)
Lines 3-9 use Koha::Installer::Output qw(say_warning say_success say_info); Link Here
3
3
4
return {
4
return {
5
    bug_number  => "38924",
5
    bug_number  => "38924",
6
    description => "Add patron quota table and permissions",
6
    description => "Add patron quota and quota_usage tables and permissions",
7
    up          => sub {
7
    up          => sub {
8
        my ($args) = @_;
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
Lines 36-40 return { Link Here
36
        } else {
36
        } else {
37
            say_info( $out, "Patron quota table already exists" );
37
            say_info( $out, "Patron quota table already exists" );
38
        }
38
        }
39
40
        unless ( TableExists('patron_quota_usage') )
41
        {
42
            $dbh->do(q{
43
                CREATE TABLE `patron_quota_usage` (
44
                  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for quota usage record',
45
                  `patron_quota_id` int(11) NOT NULL COMMENT 'foreign key linking to patron_quota.id',
46
                  `issue_id` int(11) DEFAULT NULL COMMENT 'linking to issues.issue_id or old_issues.issue_id',
47
                  `patron_id` int(11) NOT NULL COMMENT 'foreign key linking to borrowers.borrowernumber',
48
                  PRIMARY KEY (`id`),
49
                  KEY `patron_quota_usage_ibfk_1` (`patron_quota_id`),
50
51
                  KEY `patron_quota_usage_ibfk_2` (`patron_id`),
52
                  CONSTRAINT `patron_quota_usage_ibfk_1` FOREIGN KEY (`patron_quota_id`) REFERENCES `patron_quota` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
53
                  CONSTRAINT `patron_quota_usage_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
54
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
55
            });
56
57
            say_success( $out, "Patron quota usage table created successfully" );
58
        } else {
59
            say_info( $out, "Patron quota usage table already exists" );
60
        }
39
    },
61
    },
40
};
62
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +21 lines)
Lines 7135-7140 CREATE TABLE `patron_quota` ( Link Here
7135
/*!40101 SET character_set_client = @saved_cs_client */;
7135
/*!40101 SET character_set_client = @saved_cs_client */;
7136
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
7136
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
7137
7137
7138
--
7139
-- Table structure for table `patron_quota_usage`
7140
--
7141
7142
DROP TABLE IF EXISTS `patron_quota_usage`;
7143
/*!40101 SET @saved_cs_client     = @@character_set_client */;
7144
/*!40101 SET character_set_client = utf8 */;
7145
CREATE TABLE `patron_quota_usage` (
7146
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for quota usage record',
7147
  `patron_quota_id` int(11) NOT NULL COMMENT 'foreign key linking to patron_quota.id',
7148
  `issue_id` int(11) DEFAULT NULL COMMENT 'linking to issues.issue_id or old_issues.issue_id',
7149
  `patron_id` int(11) NOT NULL COMMENT 'foreign key linking to borrowers.borrowernumber',
7150
  PRIMARY KEY (`id`),
7151
  KEY `patron_quota_usage_ibfk_1` (`patron_quota_id`),
7152
  KEY `patron_quota_usage_ibfk_2` (`patron_id`),
7153
  CONSTRAINT `patron_quota_usage_ibfk_1` FOREIGN KEY (`patron_quota_id`) REFERENCES `patron_quota` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
7154
  CONSTRAINT `patron_quota_usage_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
7155
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;     
7156
/*!40101 SET character_set_client = @saved_cs_client */;
7157
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
7158
7138
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
7159
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
7139
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
7160
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
7140
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
7161
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
7141
- 

Return to bug 38924