diff --git a/prisma/migrations/20240710224753_fix_relation_zone_object/migration.sql b/prisma/migrations/20240710224753_fix_relation_zone_object/migration.sql new file mode 100644 index 0000000..0c23188 --- /dev/null +++ b/prisma/migrations/20240710224753_fix_relation_zone_object/migration.sql @@ -0,0 +1,5 @@ +-- DropForeignKey +ALTER TABLE `ZoneObject` DROP FOREIGN KEY `ZoneObject_objectId_fkey`; + +-- AddForeignKey +ALTER TABLE `ZoneObject` ADD CONSTRAINT `ZoneObject_objectId_fkey` FOREIGN KEY (`objectId`) REFERENCES `Object`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 731836c..c479de2 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -98,7 +98,7 @@ model ZoneObject { zoneId Int zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade) objectId String - object Object @relation(fields: [objectId], references: [id]) + object Object @relation(fields: [objectId], references: [id], onDelete: Cascade) depth Int position_x Int position_y Int