Skip to content

Commit

Permalink
Add migrations, fix author, sync with other projects
Browse files Browse the repository at this point in the history
  • Loading branch information
linuswillner committed Dec 22, 2024
1 parent c902835 commit 8dcb100
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 39 deletions.
68 changes: 34 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,22 @@
"build": "tsc",
"build:watch": "tsc --watch --preserveWatchOutput",
"cleaner": "ts-cleaner --dist lib --watch",
"sync": "slash-up sync",
"sync:dev": "slash-up sync -e development",
"build:ci": "prisma generate && tsc",
"sync:prod": "slash-up sync --debug",
"lint": "eslint . --ext .ts",
"lint:fix": "npm run lint -- --fix",
"test": "jest",
"test:watch": "jest --watch",
"prepare": "husky install",
"deploy:form": "clasp push",
"heroku-postbuild": "prisma migrate deploy && npm run build:ci",
"deploy-form": "clasp push",
"deploy-migrations": "prisma migrate deploy",
"doc": "typedoc --out docs src"
},
"repository": {
"type": "git",
"url": "git+https://github.com/TheCodingDen/projects-bot.git"
},
"author": "Linus Willner <hello@linuswillner.me> (https://linuswillner.me)",
"author": "The Coding Den",
"license": "MIT",
"bugs": {
"url": "https://github.com/TheCodingDen/projects-bot/issues"
Expand Down
62 changes: 62 additions & 0 deletions prisma/migrations/20241222191651_init/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
-- CreateEnum
CREATE TYPE "VoteType" AS ENUM ('UPVOTE', 'DOWNVOTE', 'PAUSE', 'UNPAUSE');

-- CreateEnum
CREATE TYPE "VoteRole" AS ENUM ('STAFF', 'VETERANS');

-- CreateEnum
CREATE TYPE "SubmissionState" AS ENUM ('RAW', 'WARNING', 'PROCESSING', 'PAUSED', 'ERROR', 'ACCEPTED', 'DENIED');

-- CreateTable
CREATE TABLE "Submission" (
"id" TEXT NOT NULL,
"messageId" TEXT,
"reviewThreadId" TEXT,
"feedbackThreadId" TEXT,
"name" TEXT NOT NULL,
"description" TEXT NOT NULL,
"state" "SubmissionState" NOT NULL,
"authorId" TEXT NOT NULL,
"submittedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"techUsed" TEXT NOT NULL,
"sourceLinks" TEXT NOT NULL,
"otherLinks" TEXT NOT NULL,

CONSTRAINT "Submission_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Vote" (
"voterId" TEXT NOT NULL,
"type" "VoteType" NOT NULL,
"role" "VoteRole" NOT NULL,
"submissionId" TEXT NOT NULL,

CONSTRAINT "Vote_pkey" PRIMARY KEY ("voterId","submissionId","type")
);

-- CreateTable
CREATE TABLE "Draft" (
"id" TEXT NOT NULL,
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"content" TEXT NOT NULL,
"authorId" TEXT NOT NULL,
"submissionId" TEXT NOT NULL,

CONSTRAINT "Draft_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "Submission_messageId_key" ON "Submission"("messageId");

-- CreateIndex
CREATE UNIQUE INDEX "Submission_reviewThreadId_key" ON "Submission"("reviewThreadId");

-- CreateIndex
CREATE UNIQUE INDEX "Submission_feedbackThreadId_key" ON "Submission"("feedbackThreadId");

-- AddForeignKey
ALTER TABLE "Vote" ADD CONSTRAINT "Vote_submissionId_fkey" FOREIGN KEY ("submissionId") REFERENCES "Submission"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Draft" ADD CONSTRAINT "Draft_submissionId_fkey" FOREIGN KEY ("submissionId") REFERENCES "Submission"("id") ON DELETE CASCADE ON UPDATE CASCADE;
3 changes: 3 additions & 0 deletions prisma/migrations/migration_lock.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"

0 comments on commit 8dcb100

Please sign in to comment.