Lines 2732-2748
CREATE TABLE `accountlines` (
Link Here
|
2732 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
2732 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
2733 |
|
2733 |
|
2734 |
-- |
2734 |
-- |
2735 |
-- Table structure for table `accountoffsets` |
2735 |
-- Table structure for table `account_offsets` |
2736 |
-- |
2736 |
-- |
2737 |
|
2737 |
|
2738 |
DROP TABLE IF EXISTS `accountoffsets`; |
2738 |
DROP TABLE IF EXISTS `account_offsets`; |
2739 |
CREATE TABLE `accountoffsets` ( |
2739 |
CREATE TABLE `account_offsets` ( |
2740 |
`borrowernumber` int(11) NOT NULL default 0, |
2740 |
`id` int(11) NOT NULL auto_increment, -- unique identifier for each offset |
2741 |
`accountno` smallint(6) NOT NULL default 0, |
2741 |
`credit_id` int(11) NULL DEFAULT NULL, -- The id of the accountline the increased the patron's balance |
2742 |
`offsetaccount` smallint(6) NOT NULL default 0, |
2742 |
`debit_id` int(11) NULL DEFAULT NULL, -- The id of the accountline that decreased the patron's balance |
2743 |
`offsetamount` decimal(28,6) default NULL, |
2743 |
`type` varchar(16) NOT NULL, -- The type of offset this is |
2744 |
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, |
2744 |
`amount` decimal(26,6) NOT NULL, -- The amount of the change |
2745 |
CONSTRAINT `accountoffsets_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE |
2745 |
`created_on` timestamp NOT NULL default CURRENT_TIMESTAMP, |
|
|
2746 |
PRIMARY KEY (`id`), |
2747 |
CONSTRAINT `account_offsets_ibfk_p` FOREIGN KEY (`credit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE, |
2748 |
CONSTRAINT `account_offsets_ibfk_f` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE |
2746 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
2749 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
2747 |
|
2750 |
|
2748 |
-- |
2751 |
-- |
2749 |
- |
|
|