salix/db/versions/.archive/10585-pinkMedeola/07-shelvingLog.sql

15 lines
664 B
MySQL
Raw Permalink Normal View History

ALTER TABLE `vn`.`shelvingLog`
CHANGE COLUMN `changedModel` `changedModel` ENUM('Shelving') NOT NULL DEFAULT 'Shelving',
MODIFY COLUMN changedModelId INT(11) NOT NULL,
MODIFY COLUMN oldInstance JSON NULL,
MODIFY COLUMN newInstance JSON NULL,
ADD INDEX IF NOT EXISTS `shelvingLog_changedModel` (`changedModel` ASC, `changedModelId` ASC, `creationDate` ASC),
ADD INDEX IF NOT EXISTS `shelvingLog_originFk` (`originFk` ASC, `creationDate` ASC),
DROP INDEX IF EXISTS `originFk` ;
;
ALTER TABLE `vn`.`shelvingLog`
ADD CONSTRAINT `shelvingLog_ibfk_1`
FOREIGN KEY IF NOT EXISTS (`originFk`)
REFERENCES `vn`.`shelving` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE;