bug fixes

This commit is contained in:
daniel31x13
2024-10-30 16:47:40 -04:00
parent fa1f9873d5
commit 508844dd9d
9 changed files with 82 additions and 30 deletions
@@ -0,0 +1,17 @@
-- DropForeignKey
ALTER TABLE "Collection" DROP CONSTRAINT "Collection_createdById_fkey";
-- DropForeignKey
ALTER TABLE "Link" DROP CONSTRAINT "Link_createdById_fkey";
-- AlterTable
ALTER TABLE "Collection" ALTER COLUMN "createdById" DROP NOT NULL;
-- AlterTable
ALTER TABLE "Link" ALTER COLUMN "createdById" DROP NOT NULL;
-- AddForeignKey
ALTER TABLE "Collection" ADD CONSTRAINT "Collection_createdById_fkey" FOREIGN KEY ("createdById") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Link" ADD CONSTRAINT "Link_createdById_fkey" FOREIGN KEY ("createdById") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
+4 -4
View File
@@ -108,8 +108,8 @@ model Collection {
owner User @relation(fields: [ownerId], references: [id])
ownerId Int
members UsersAndCollections[]
createdBy User @relation("CreatedCollections", fields: [createdById], references: [id])
createdById Int
createdBy User? @relation("CreatedCollections", fields: [createdById], references: [id])
createdById Int?
links Link[]
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
@@ -138,8 +138,8 @@ model Link {
type String @default("url")
description String @default("")
pinnedBy User[] @relation("PinnedLinks")
createdBy User @relation("CreatedLinks", fields: [createdById], references: [id])
createdById Int
createdBy User? @relation("CreatedLinks", fields: [createdById], references: [id])
createdById Int?
collection Collection @relation(fields: [collectionId], references: [id])
collectionId Int
tags Tag[]