From d3eaf251cd7714c826e8bf5c2372ff00821baace Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 23 Jul 2019 14:05:18 +0100 Subject: [PATCH] Bug 23355: Add cash_register_actions table --- .../data/mysql/atomicupdate/bug_23355.perl | 19 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 16 ++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_23355.perl diff --git a/installer/data/mysql/atomicupdate/bug_23355.perl b/installer/data/mysql/atomicupdate/bug_23355.perl new file mode 100644 index 0000000000..6517d5361c --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_23355.perl @@ -0,0 +1,19 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if ( CheckVersion($DBversion) ) { + + $dbh->do(qq{ +CREATE TABLE `cash_register_actions` ( + `id` int(11) NOT NULL auto_increment, -- unique identifier for each account register action + `code` varchar(24) NOT NULL, -- action code denoting the type of action recorded (enum), + `manager_id` int(11) NOT NULL, -- staff member performing the action + `amount` decimal(28,6) DEFAULT NULL, -- amount recorded in action (signed) + `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + CONSTRAINT `cash_register_actions_manager` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `cash_register_actions_register` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + }); + + SetVersion($DBversion); + print "Upgrade to $DBversion done (Bug 23355 - Add cash_register_actions table)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index aa5817d823..fb8b863c3c 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2682,6 +2682,22 @@ CREATE TABLE `account_offsets` ( CONSTRAINT `account_offsets_ibfk_t` FOREIGN KEY (`type`) REFERENCES `account_offset_types` (`type`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +-- +-- Table structure for table `cash_register_actions` +-- + +CREATE TABLE `cash_register_actions` ( + `id` int(11) NOT NULL auto_increment, -- unique identifier for each account register action + `code` varchar(24) NOT NULL, -- action code denoting the type of action recorded (enum), + `register_id` int(11) NOT NULL, -- id of cash_register this action belongs to, + `manager_id` int(11) NOT NULL, -- staff member performing the action + `amount` decimal(28,6) DEFAULT NULL, -- amount recorded in action (signed) + `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + CONSTRAINT `cash_register_actions_manager` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `cash_register_actions_register` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + -- -- Table structure for table `action_logs` -- -- 2.20.1