Bug 14826: DBRev 17.06.00.017
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
f4d702c668
commit
3b04f401b9
2
Koha.pm
2
Koha.pm
|
|
@ -29,7 +29,7 @@ use vars qw{ $VERSION };
|
|||
# - #4 : the developer version. The 4th number is the database subversion.
|
||||
# used by developers when the database changes. updatedatabase take care of the changes itself
|
||||
# and is automatically called by Auth.pm when needed.
|
||||
$VERSION = "17.06.00.016";
|
||||
$VERSION = "17.06.00.017";
|
||||
|
||||
sub version {
|
||||
return $VERSION;
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
DROP TABLE IF EXISTS `accountoffsets`;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `account_offset_types` (
|
||||
`type` varchar(16) NOT NULL, -- The type of offset this is
|
||||
PRIMARY KEY (`type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
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,
|
||||
CONSTRAINT `account_offsets_ibfk_t` FOREIGN KEY (`type`) REFERENCES `account_offset_types` (`type`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
INSERT IGNORE INTO account_offset_types ( type ) VALUES
|
||||
('Writeoff'),
|
||||
('Payment'),
|
||||
('Lost Item'),
|
||||
('Manual Debit'),
|
||||
('Reverse Payment'),
|
||||
('Forgiven'),
|
||||
('Dropbox'),
|
||||
('Rental Fee'),
|
||||
('Fine Update'),
|
||||
('Fine');
|
||||
|
|
@ -14772,6 +14772,54 @@ if( CheckVersion( $DBversion ) ) {
|
|||
print "Upgrade to $DBversion done (Bug 18298 - Allow enforcing password complexity (system preference RequireStrongPassword))\n";
|
||||
}
|
||||
|
||||
$DBversion = '17.06.00.017';
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
unless (TableExists('account_offsets')) {
|
||||
$dbh->do(q{
|
||||
DROP TABLE IF EXISTS `accountoffsets`;
|
||||
});
|
||||
|
||||
$dbh->do(q{
|
||||
CREATE TABLE IF NOT EXISTS `account_offset_types` (
|
||||
`type` varchar(16) NOT NULL, -- The type of offset this is
|
||||
PRIMARY KEY (`type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
});
|
||||
|
||||
$dbh->do(q{
|
||||
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,
|
||||
CONSTRAINT `account_offsets_ibfk_t` FOREIGN KEY (`type`) REFERENCES `account_offset_types` (`type`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
});
|
||||
|
||||
$dbh->do(q{
|
||||
INSERT IGNORE INTO account_offset_types ( type ) VALUES
|
||||
('Writeoff'),
|
||||
('Payment'),
|
||||
('Lost Item'),
|
||||
('Manual Debit'),
|
||||
('Reverse Payment'),
|
||||
('Forgiven'),
|
||||
('Dropbox'),
|
||||
('Rental Fee'),
|
||||
('Fine Update'),
|
||||
('Fine');
|
||||
});
|
||||
}
|
||||
|
||||
SetVersion( $DBversion );
|
||||
print "Upgrade to $DBversion done (Bug 14826 - Resurrect account offsets table (Add new tables account_offsets and account_offset_types))\n";
|
||||
}
|
||||
|
||||
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
|
||||
# SEE bug 13068
|
||||
# if there is anything in the atomicupdate, read and execute it.
|
||||
|
|
|
|||
Loading…
Reference in New Issue