-- Alembic Revision: 54290c977da3

LOCK TABLES
    held_ticket_item_discounts WRITE,
    ticket_item_discounts WRITE;

ALTER TABLE held_ticket_item_discounts MODIFY value INT(11) NULL;
ALTER TABLE held_ticket_item_discounts RENAME INDEX `fk_held_ticket_item_discounts_ticket_items` TO `fk-held_ticket_item_discounts-held_ticket_items`;
ALTER TABLE held_ticket_item_discounts
    DROP FOREIGN KEY `fk_held_ticket_item_discounts_ticket_items`,
    ADD CONSTRAINT `fk-held_ticket_item_discounts-held_ticket_items` FOREIGN KEY (`ticket_item_key`, `_cache_id`)
        REFERENCES `held_ticket_items` (`key`, `_cache_id`) ON DELETE cascade ON UPDATE cascade;

ALTER TABLE ticket_item_discounts MODIFY value INT(11) NULL;
ALTER TABLE ticket_item_discounts RENAME INDEX `fk_ticket_item_discounts_ticket_items` TO `fk-ticket_item_discounts-ticket_items`;
ALTER TABLE ticket_item_discounts
    DROP FOREIGN KEY `fk_ticket_item_discounts_ticket_items`,
    ADD CONSTRAINT `fk-ticket_item_discounts-ticket_items` FOREIGN KEY (`ticket_item_key`, `_cache_id`)
        REFERENCES `ticket_items` (`key`, `_cache_id`) ON DELETE cascade ON UPDATE cascade;

UNLOCK TABLES;
