Skip to content

Commit 8dcb100

Browse files
committed
Add migrations, fix author, sync with other projects
1 parent c902835 commit 8dcb100

File tree

4 files changed

+103
-39
lines changed

4 files changed

+103
-39
lines changed

package-lock.json

Lines changed: 34 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,22 @@
1212
"build": "tsc",
1313
"build:watch": "tsc --watch --preserveWatchOutput",
1414
"cleaner": "ts-cleaner --dist lib --watch",
15-
"sync": "slash-up sync",
1615
"sync:dev": "slash-up sync -e development",
17-
"build:ci": "prisma generate && tsc",
16+
"sync:prod": "slash-up sync --debug",
1817
"lint": "eslint . --ext .ts",
1918
"lint:fix": "npm run lint -- --fix",
2019
"test": "jest",
2120
"test:watch": "jest --watch",
2221
"prepare": "husky install",
23-
"deploy:form": "clasp push",
24-
"heroku-postbuild": "prisma migrate deploy && npm run build:ci",
22+
"deploy-form": "clasp push",
23+
"deploy-migrations": "prisma migrate deploy",
2524
"doc": "typedoc --out docs src"
2625
},
2726
"repository": {
2827
"type": "git",
2928
"url": "git+https://github.com/TheCodingDen/projects-bot.git"
3029
},
31-
"author": "Linus Willner <[email protected]> (https://linuswillner.me)",
30+
"author": "The Coding Den",
3231
"license": "MIT",
3332
"bugs": {
3433
"url": "https://github.com/TheCodingDen/projects-bot/issues"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
-- CreateEnum
2+
CREATE TYPE "VoteType" AS ENUM ('UPVOTE', 'DOWNVOTE', 'PAUSE', 'UNPAUSE');
3+
4+
-- CreateEnum
5+
CREATE TYPE "VoteRole" AS ENUM ('STAFF', 'VETERANS');
6+
7+
-- CreateEnum
8+
CREATE TYPE "SubmissionState" AS ENUM ('RAW', 'WARNING', 'PROCESSING', 'PAUSED', 'ERROR', 'ACCEPTED', 'DENIED');
9+
10+
-- CreateTable
11+
CREATE TABLE "Submission" (
12+
"id" TEXT NOT NULL,
13+
"messageId" TEXT,
14+
"reviewThreadId" TEXT,
15+
"feedbackThreadId" TEXT,
16+
"name" TEXT NOT NULL,
17+
"description" TEXT NOT NULL,
18+
"state" "SubmissionState" NOT NULL,
19+
"authorId" TEXT NOT NULL,
20+
"submittedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
21+
"techUsed" TEXT NOT NULL,
22+
"sourceLinks" TEXT NOT NULL,
23+
"otherLinks" TEXT NOT NULL,
24+
25+
CONSTRAINT "Submission_pkey" PRIMARY KEY ("id")
26+
);
27+
28+
-- CreateTable
29+
CREATE TABLE "Vote" (
30+
"voterId" TEXT NOT NULL,
31+
"type" "VoteType" NOT NULL,
32+
"role" "VoteRole" NOT NULL,
33+
"submissionId" TEXT NOT NULL,
34+
35+
CONSTRAINT "Vote_pkey" PRIMARY KEY ("voterId","submissionId","type")
36+
);
37+
38+
-- CreateTable
39+
CREATE TABLE "Draft" (
40+
"id" TEXT NOT NULL,
41+
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
42+
"content" TEXT NOT NULL,
43+
"authorId" TEXT NOT NULL,
44+
"submissionId" TEXT NOT NULL,
45+
46+
CONSTRAINT "Draft_pkey" PRIMARY KEY ("id")
47+
);
48+
49+
-- CreateIndex
50+
CREATE UNIQUE INDEX "Submission_messageId_key" ON "Submission"("messageId");
51+
52+
-- CreateIndex
53+
CREATE UNIQUE INDEX "Submission_reviewThreadId_key" ON "Submission"("reviewThreadId");
54+
55+
-- CreateIndex
56+
CREATE UNIQUE INDEX "Submission_feedbackThreadId_key" ON "Submission"("feedbackThreadId");
57+
58+
-- AddForeignKey
59+
ALTER TABLE "Vote" ADD CONSTRAINT "Vote_submissionId_fkey" FOREIGN KEY ("submissionId") REFERENCES "Submission"("id") ON DELETE CASCADE ON UPDATE CASCADE;
60+
61+
-- AddForeignKey
62+
ALTER TABLE "Draft" ADD CONSTRAINT "Draft_submissionId_fkey" FOREIGN KEY ("submissionId") REFERENCES "Submission"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Please do not edit this file manually
2+
# It should be added in your version-control system (e.g., Git)
3+
provider = "postgresql"

0 commit comments

Comments
 (0)