From 414124cbcb7d36a9d3ef49993d9215b2cc184cd4 Mon Sep 17 00:00:00 2001 From: Grant Date: Mon, 8 Jul 2024 18:07:27 -0600 Subject: [PATCH] remove Pixel -> PaletteColor constraint, it's not needed and prevents palette changes --- packages/server/prisma/dbml/schema.dbml | 4 ---- .../20240709000713_drop_pixel_constraint/migration.sql | 2 ++ packages/server/prisma/schema.prisma | 7 +++---- 3 files changed, 5 insertions(+), 8 deletions(-) create mode 100644 packages/server/prisma/migrations/20240709000713_drop_pixel_constraint/migration.sql diff --git a/packages/server/prisma/dbml/schema.dbml b/packages/server/prisma/dbml/schema.dbml index aeaab2d..7bb50e8 100644 --- a/packages/server/prisma/dbml/schema.dbml +++ b/packages/server/prisma/dbml/schema.dbml @@ -35,7 +35,6 @@ Table PaletteColor { id Int [pk, increment] name String [not null] hex String [unique, not null] - pixels Pixel [not null] } Table Pixel { @@ -49,7 +48,6 @@ Table Pixel { createdAt DateTime [default: `now()`, not null] deletedAt DateTime user User [not null] - pallete PaletteColor [not null] } Table Faction { @@ -117,8 +115,6 @@ Table Ban { Ref: Pixel.userId > User.sub -Ref: Pixel.color > PaletteColor.hex - Ref: FactionMember.sub > User.sub Ref: FactionMember.factionId > Faction.id diff --git a/packages/server/prisma/migrations/20240709000713_drop_pixel_constraint/migration.sql b/packages/server/prisma/migrations/20240709000713_drop_pixel_constraint/migration.sql new file mode 100644 index 0000000..ed6bf43 --- /dev/null +++ b/packages/server/prisma/migrations/20240709000713_drop_pixel_constraint/migration.sql @@ -0,0 +1,2 @@ +-- DropForeignKey +ALTER TABLE "Pixel" DROP CONSTRAINT "Pixel_color_fkey"; diff --git a/packages/server/prisma/schema.prisma b/packages/server/prisma/schema.prisma index f1ff208..5c34498 100644 --- a/packages/server/prisma/schema.prisma +++ b/packages/server/prisma/schema.prisma @@ -50,8 +50,6 @@ model PaletteColor { id Int @id @default(autoincrement()) name String hex String @unique - - pixels Pixel[] } model Pixel { @@ -66,8 +64,9 @@ model Pixel { createdAt DateTime @default(now()) deletedAt DateTime? - user User @relation(fields: [userId], references: [sub]) - pallete PaletteColor @relation(fields: [color], references: [hex]) + user User @relation(fields: [userId], references: [sub]) + // do not add a relation to PaletteColor, in the case the palette gets changed + // https://github.com/prisma/prisma/issues/18058 } model Faction {