added prisma migration thingy and updated readme

This commit is contained in:
Joonas 2023-01-17 17:31:44 +02:00
parent cd829e78d6
commit 9c30798e48
3 changed files with 26 additions and 1 deletions

View File

@ -25,7 +25,7 @@ Set DATABASE_URL with .env
git clone https://git.disroot.org/qwertyasdfgh/imageboard
cd imageboard
pnpm install
pnpm prisma db push
pnpm prisma migrate dev
pnpm run build
pnpm start
```

View File

@ -0,0 +1,22 @@
-- CreateTable
CREATE TABLE "Thread" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"title" TEXT NOT NULL,
"post" TEXT NOT NULL,
"imageName" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
-- CreateTable
CREATE TABLE "Post" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"comment" TEXT NOT NULL,
"imageName" TEXT,
"replyingTo" INTEGER,
"postId" INTEGER NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "Post_replyingTo_fkey" FOREIGN KEY ("replyingTo") REFERENCES "Post" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT "Post_postId_fkey" FOREIGN KEY ("postId") REFERENCES "Thread" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);

View File

@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "sqlite"