SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `treasures` CASCADE;
CREATE TABLE `treasures` (`id` bigint NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` varchar(255), `type` varchar(255), `looter_type` varchar(255), `looter_id` bigint, `ship_id` bigint,  INDEX `index_treasures_on_looter_type_and_looter_id`  (`looter_type`, `looter_id`),  INDEX `index_treasures_on_ship_id`  (`ship_id`));
DROP TABLE IF EXISTS `parrots_treasures`;
CREATE TABLE `parrots_treasures` (`parrot_id` bigint, `treasure_id` bigint,  INDEX `index_parrots_treasures_on_parrot_id`  (`parrot_id`),  INDEX `index_parrots_treasures_on_treasure_id`  (`treasure_id`), CONSTRAINT `fk_rails_2a549fd937` FOREIGN KEY (`parrot_id`) REFERENCES `treasures` (`id`));
DELETE FROM `parrots_treasures`;
DELETE FROM `treasures`;
INSERT INTO `parrots_treasures` (`parrot_id`, `treasure_id`) VALUES (115895821, 207281424), (115895821, 25772709), (38589792, 207281424), (38589792, 25772709), (380982691, 307951437), (380982691, 25772709), (380424410, 307951437), (380424410, 25772709), (4, 25772709), (4, 207281424), (136705135, 25772709), (136705135, 207281424);
INSERT INTO `treasures` (`id`, `name`, `type`, `looter_type`, `looter_id`, `ship_id`) VALUES (307951437, 'diamond', DEFAULT, DEFAULT, DEFAULT, DEFAULT), (25772709, 'sapphire', DEFAULT, 'Pirate', 812997556, DEFAULT), (207281424, 'ruby', DEFAULT, 'Parrot', 380424410, DEFAULT);
SET FOREIGN_KEY_CHECKS = 1;
SELECT * FROM `treasures` INNER JOIN `parrots_treasures` ON `treasures`.`id` = `parrots_treasures`.`treasure_id` WHERE `parrots_treasures`.`parrot_id` = 136705135 AND `treasures`.`id` = 25772709 LIMIT 1\G;
