sublime fkt but everything working
This commit is contained in:
1 parent
b655adc305
commit
66228047f4
12 files changed
+363
-123
No files matched your search
@@ -0,0 +1,38 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "attachments" (
|
||||
"id" BIGINT NOT NULL,
|
||||
"msgId" BIGINT NOT NULL,
|
||||
"channelId" BIGINT NOT NULL,
|
||||
"memeId" UUID NOT NULL,
|
||||
"url" TEXT NOT NULL,
|
||||
"contentType" TEXT NOT NULL,
|
||||
"message" JSONB NOT NULL,
|
||||
"guild" JSONB NOT NULL,
|
||||
"channel" JSONB NOT NULL,
|
||||
"vision" JSONB NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "attachments_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "memes" (
|
||||
"id" UUID NOT NULL DEFAULT gen_random_uuid(),
|
||||
"url" TEXT NOT NULL,
|
||||
"text" TEXT NOT NULL,
|
||||
"tags" JSONB NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "memes_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "attachments_memeId_key" ON "attachments"("memeId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "attachments_channelId_idx" ON "attachments"("channelId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "attachments" ADD CONSTRAINT "attachments_memeId_fkey" FOREIGN KEY ("memeId") REFERENCES "memes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[attachmentId]` on the table `memes` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "memes" ADD COLUMN "attachmentId" BIGINT;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "memes_attachmentId_key" ON "memes"("attachmentId");
|
||||
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (i.e. Git)
|
||||
provider = "postgresql"
|
||||
@@ -26,7 +26,7 @@ model Attachment {
|
||||
vision Json
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
updatedAt DateTime @default(now())
|
||||
|
||||
@@index([channelId])
|
||||
@@map("attachments")
|
||||
@@ -39,8 +39,11 @@ model Meme {
|
||||
tags Json
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
updatedAt DateTime @default(now())
|
||||
|
||||
// required to prevent the same attachment being uploaded multiple times
|
||||
// nullable because maybe will have memes that don't come from a discord attachment
|
||||
attachmentId BigInt? @unique
|
||||
attachment Attachment?
|
||||
|
||||
@@map("memes")
|
||||
|
||||
Reference in new issue
Block a user