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 6814-6819 CREATE TABLE `patron_quota` ( Link Here
6814
/*!40101 SET character_set_client = @saved_cs_client */;
6814
/*!40101 SET character_set_client = @saved_cs_client */;
6815
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
6815
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
6816
6816
6817
--
6818
-- Table structure for table `patron_quota_usage`
6819
--
6820
6821
DROP TABLE IF EXISTS `patron_quota_usage`;
6822
/*!40101 SET @saved_cs_client     = @@character_set_client */;
6823
/*!40101 SET character_set_client = utf8 */;
6824
CREATE TABLE `patron_quota_usage` (
6825
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier for quota usage record',
6826
  `patron_quota_id` int(11) NOT NULL COMMENT 'foreign key linking to patron_quota.id',
6827
  `issue_id` int(11) DEFAULT NULL COMMENT 'linking to issues.issue_id or old_issues.issue_id',
6828
  `patron_id` int(11) NOT NULL COMMENT 'foreign key linking to borrowers.borrowernumber',
6829
  PRIMARY KEY (`id`),
6830
  KEY `patron_quota_usage_ibfk_1` (`patron_quota_id`),
6831
  KEY `patron_quota_usage_ibfk_2` (`patron_id`),
6832
  CONSTRAINT `patron_quota_usage_ibfk_1` FOREIGN KEY (`patron_quota_id`) REFERENCES `patron_quota` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
6833
  CONSTRAINT `patron_quota_usage_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
6834
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6835
/*!40101 SET character_set_client = @saved_cs_client */;
6836
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
6837
6817
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
6838
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
6818
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
6839
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
6819
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
6840
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
6820
- 

Return to bug 38924