Bug 14826: (QA follow-up) Make db update idempotent

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Kyle Hall 2017-10-12 12:00:48 -04:00 committed by Jonathan Druart
parent 7417dd3704
commit 2dd0d6c359

View file

@ -1,4 +1,6 @@
CREATE TABLE `account_offset_types` ( DROP TABLE IF EXISTS `accountoffsets`;
CREATE TABLE IF NOT EXISTS `account_offset_types` (
`type` varchar(16) NOT NULL, -- The type of offset this is `type` varchar(16) NOT NULL, -- The type of offset this is
PRIMARY KEY (`type`) PRIMARY KEY (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@ -16,7 +18,7 @@ CREATE TABLE IF NOT EXISTS `account_offsets` (
CONSTRAINT `account_offsets_ibfk_t` FOREIGN KEY (`type`) REFERENCES `account_offset_types` (`type`) 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; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO account_offset_types ( type ) VALUES INSERT IGNORE INTO account_offset_types ( type ) VALUES
('Writeoff'), ('Writeoff'),
('Payment'), ('Payment'),
('Lost Item'), ('Lost Item'),