added prisma migration thingy and updated readme
This commit is contained in:
parent
cd829e78d6
commit
9c30798e48
|
@ -25,7 +25,7 @@ Set DATABASE_URL with .env
|
||||||
git clone https://git.disroot.org/qwertyasdfgh/imageboard
|
git clone https://git.disroot.org/qwertyasdfgh/imageboard
|
||||||
cd imageboard
|
cd imageboard
|
||||||
pnpm install
|
pnpm install
|
||||||
pnpm prisma db push
|
pnpm prisma migrate dev
|
||||||
pnpm run build
|
pnpm run build
|
||||||
pnpm start
|
pnpm start
|
||||||
```
|
```
|
||||||
|
|
|
@ -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
|
||||||
|
);
|
|
@ -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"
|
Loading…
Reference in New Issue