From 05034b38b61cc89639b41d99c880e7d28e9ff2ae Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 7 Feb 2025 11:20:21 +0000 Subject: [PATCH] Bug 38924: Add type and timestamp to usage table This allows us to more easily audit what actions incremented the usage and when. We will use this later in display --- .../data/mysql/atomicupdate/bug_38924-patron_quotas.pl | 6 ++++-- installer/data/mysql/kohastructure.sql | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_38924-patron_quotas.pl b/installer/data/mysql/atomicupdate/bug_38924-patron_quotas.pl index 53a6a174a19..7c1ae600b1a 100755 --- a/installer/data/mysql/atomicupdate/bug_38924-patron_quotas.pl +++ b/installer/data/mysql/atomicupdate/bug_38924-patron_quotas.pl @@ -45,10 +45,12 @@ return { `patron_quota_id` int(11) NOT NULL COMMENT 'foreign key linking to patron_quota.id', `issue_id` int(11) DEFAULT NULL COMMENT 'linking to issues.issue_id or old_issues.issue_id', `patron_id` int(11) NOT NULL COMMENT 'foreign key linking to borrowers.borrowernumber', + `type` enum('ISSUE','RENEW') NOT NULL COMMENT 'The type of usage this is', + `creation_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the timestamp for when a usage was recorded', PRIMARY KEY (`id`), KEY `patron_quota_usage_ibfk_1` (`patron_quota_id`), - KEY `patron_quota_usage_ibfk_2` (`patron_id`), + KEY `patron_quota_usage_issue_id` (`issue_id`), CONSTRAINT `patron_quota_usage_ibfk_1` FOREIGN KEY (`patron_quota_id`) REFERENCES `patron_quota` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `patron_quota_usage_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; @@ -61,7 +63,7 @@ return { $dbh->do(q{ INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) - VALUES + VALUES ('AllowQuotaOverride', '0', NULL, 'Allow staff to override and check out items to patrons who have exceeded their quota limit', 'YesNo'), ('UseGuarantorQuota', '0', NULL, 'Use guarantor quota instead of guarantee quota when checking out items', 'YesNo') }); diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 143e29a0cd3..f784bd39e13 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -6822,9 +6822,12 @@ CREATE TABLE `patron_quota_usage` ( `patron_quota_id` int(11) NOT NULL COMMENT 'foreign key linking to patron_quota.id', `issue_id` int(11) DEFAULT NULL COMMENT 'linking to issues.issue_id or old_issues.issue_id', `patron_id` int(11) NOT NULL COMMENT 'foreign key linking to borrowers.borrowernumber', + `type` enum('ISSUE','RENEW') NOT NULL COMMENT 'The type of usage this is', + `creation_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the timestamp for when a usage was recorded', PRIMARY KEY (`id`), KEY `patron_quota_usage_ibfk_1` (`patron_quota_id`), KEY `patron_quota_usage_ibfk_2` (`patron_id`), + KEY `patron_quota_usage_issue_id` (`issue_id`), CONSTRAINT `patron_quota_usage_ibfk_1` FOREIGN KEY (`patron_quota_id`) REFERENCES `patron_quota` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `patron_quota_usage_ibfk_2` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- 2.48.1