From 3ad9a31d2e8792e1336021f320dee981781445a4 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 12 Jul 2016 13:50:11 +0000 Subject: [PATCH] Bug 14826 - Update database Signed-off-by: Josef Moravec --- installer/data/mysql/atomicupdate/bug_14826.sql | 12 ++++++++++++ installer/data/mysql/kohastructure.sql | 21 ++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_14826.sql diff --git a/installer/data/mysql/atomicupdate/bug_14826.sql b/installer/data/mysql/atomicupdate/bug_14826.sql new file mode 100644 index 0000000..91d183b --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_14826.sql @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS `accountoffsets`; +CREATE TABLE IF NOT EXISTS `account_offsets` ( + `id` int(11) NOT NULL auto_increment, -- unique identifier for each offset + `credit_id` int(11) NULL DEFAULT NULL, -- The id of the accountline the increased the patron's balance + `debit_id` int(11) NULL DEFAULT NULL, -- The id of the accountline that decreased the patron's balance + `type` varchar(16) NOT NULL, -- The type of offset this is + `amount` decimal(26,6) NOT NULL, -- The amount of the change + `created_on` timestamp NOT NULL default CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + CONSTRAINT `account_offsets_ibfk_p` FOREIGN KEY (`credit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `account_offsets_ibfk_f` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index e227125..e883ffb 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2732,17 +2732,20 @@ CREATE TABLE `accountlines` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- --- Table structure for table `accountoffsets` +-- Table structure for table `account_offsets` -- -DROP TABLE IF EXISTS `accountoffsets`; -CREATE TABLE `accountoffsets` ( - `borrowernumber` int(11) NOT NULL default 0, - `accountno` smallint(6) NOT NULL default 0, - `offsetaccount` smallint(6) NOT NULL default 0, - `offsetamount` decimal(28,6) default NULL, - `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, - CONSTRAINT `accountoffsets_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE +DROP TABLE IF EXISTS `account_offsets`; +CREATE TABLE `account_offsets` ( + `id` int(11) NOT NULL auto_increment, -- unique identifier for each offset + `credit_id` int(11) NULL DEFAULT NULL, -- The id of the accountline the increased the patron's balance + `debit_id` int(11) NULL DEFAULT NULL, -- The id of the accountline that decreased the patron's balance + `type` varchar(16) NOT NULL, -- The type of offset this is + `amount` decimal(26,6) NOT NULL, -- The amount of the change + `created_on` timestamp NOT NULL default CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + CONSTRAINT `account_offsets_ibfk_p` FOREIGN KEY (`credit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `account_offsets_ibfk_f` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- 2.10.2