Bug 14826: Update database

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Kyle Hall 2016-07-12 13:50:11 +00:00 committed by Jonathan Druart
parent 399dcaa222
commit 49eb0395de
2 changed files with 24 additions and 9 deletions

View file

@ -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;

View file

@ -2737,17 +2737,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;
--