remove Pixel -> PaletteColor constraint, it's not needed and prevents palette changes

This commit is contained in:
Grant 2024-07-08 18:07:27 -06:00
parent 5f00ca94d7
commit 414124cbcb
3 changed files with 5 additions and 8 deletions

View File

@ -35,7 +35,6 @@ Table PaletteColor {
id Int [pk, increment] id Int [pk, increment]
name String [not null] name String [not null]
hex String [unique, not null] hex String [unique, not null]
pixels Pixel [not null]
} }
Table Pixel { Table Pixel {
@ -49,7 +48,6 @@ Table Pixel {
createdAt DateTime [default: `now()`, not null] createdAt DateTime [default: `now()`, not null]
deletedAt DateTime deletedAt DateTime
user User [not null] user User [not null]
pallete PaletteColor [not null]
} }
Table Faction { Table Faction {
@ -117,8 +115,6 @@ Table Ban {
Ref: Pixel.userId > User.sub Ref: Pixel.userId > User.sub
Ref: Pixel.color > PaletteColor.hex
Ref: FactionMember.sub > User.sub Ref: FactionMember.sub > User.sub
Ref: FactionMember.factionId > Faction.id Ref: FactionMember.factionId > Faction.id

View File

@ -0,0 +1,2 @@
-- DropForeignKey
ALTER TABLE "Pixel" DROP CONSTRAINT "Pixel_color_fkey";

View File

@ -50,8 +50,6 @@ model PaletteColor {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
name String name String
hex String @unique hex String @unique
pixels Pixel[]
} }
model Pixel { model Pixel {
@ -66,8 +64,9 @@ model Pixel {
createdAt DateTime @default(now()) createdAt DateTime @default(now())
deletedAt DateTime? deletedAt DateTime?
user User @relation(fields: [userId], references: [sub]) user User @relation(fields: [userId], references: [sub])
pallete PaletteColor @relation(fields: [color], references: [hex]) // do not add a relation to PaletteColor, in the case the palette gets changed
// https://github.com/prisma/prisma/issues/18058
} }
model Faction { model Faction {