-- DropForeignKey
ALTER TABLE `permission_business_activities` DROP FOREIGN KEY `permission_business_activities_business_id_fkey`;

-- DropForeignKey
ALTER TABLE `permission_business_activities` DROP FOREIGN KEY `permission_business_activities_permission_id_fkey`;

-- DropForeignKey
ALTER TABLE `permission_complexes` DROP FOREIGN KEY `permission_complexes_complex_id_fkey`;

-- DropForeignKey
ALTER TABLE `permission_complexes` DROP FOREIGN KEY `permission_complexes_permission_id_fkey`;

-- DropForeignKey
ALTER TABLE `permission_consumers` DROP FOREIGN KEY `permission_consumers_consumer_account_id_fkey`;

-- DropForeignKey
ALTER TABLE `permission_poses` DROP FOREIGN KEY `permission_poses_permission_id_fkey`;

-- DropForeignKey
ALTER TABLE `permission_poses` DROP FOREIGN KEY `permission_poses_pos_id_fkey`;

-- DropIndex
DROP INDEX `permission_business_activities_business_id_fkey` ON `permission_business_activities`;

-- DropIndex
DROP INDEX `permission_complexes_complex_id_fkey` ON `permission_complexes`;

-- DropIndex
DROP INDEX `permission_poses_pos_id_fkey` ON `permission_poses`;

-- AddForeignKey
ALTER TABLE `permission_consumers` ADD CONSTRAINT `permission_consumers_consumer_account_id_fkey` FOREIGN KEY (`consumer_account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `permission_poses` ADD CONSTRAINT `permission_poses_pos_id_fkey` FOREIGN KEY (`pos_id`) REFERENCES `poses`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `permission_poses` ADD CONSTRAINT `permission_poses_permission_id_fkey` FOREIGN KEY (`permission_id`) REFERENCES `permission_consumers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `permission_complexes` ADD CONSTRAINT `permission_complexes_complex_id_fkey` FOREIGN KEY (`complex_id`) REFERENCES `complexes`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `permission_complexes` ADD CONSTRAINT `permission_complexes_permission_id_fkey` FOREIGN KEY (`permission_id`) REFERENCES `permission_consumers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `permission_business_activities` ADD CONSTRAINT `permission_business_activities_business_id_fkey` FOREIGN KEY (`business_id`) REFERENCES `business_activities`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `permission_business_activities` ADD CONSTRAINT `permission_business_activities_permission_id_fkey` FOREIGN KEY (`permission_id`) REFERENCES `permission_consumers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
