[resumes][chore] update migration file

pull/316/head
Keane Chan 3 years ago
parent 8433f7d60d
commit e2c8cec723
No known key found for this signature in database
GPG Key ID: 32718398E1E9F87C

@ -1,94 +0,0 @@
-- CreateEnum
CREATE TYPE "ResumesSection" AS ENUM ('GENERAL', 'EDUCATION', 'EXPERIENCE', 'PROJECTS', 'SKILLS');
-- CreateTable
CREATE TABLE "ResumesProfile" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
CONSTRAINT "ResumesProfile_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "ResumesResume" (
"id" TEXT NOT NULL,
"resumesProfileId" TEXT NOT NULL,
"title" TEXT NOT NULL,
"role" TEXT NOT NULL,
"experience" TEXT NOT NULL,
"location" TEXT NOT NULL,
"url" TEXT NOT NULL,
"additionalInfo" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "ResumesResume_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "ResumesStar" (
"id" TEXT NOT NULL,
"resumesProfileId" TEXT NOT NULL,
"resumeId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "ResumesStar_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "ResumesComment" (
"id" TEXT NOT NULL,
"resumesProfileId" TEXT NOT NULL,
"resumeId" TEXT NOT NULL,
"description" TEXT NOT NULL,
"section" "ResumesSection" NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "ResumesComment_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "ResumesCommentVote" (
"id" TEXT NOT NULL,
"resumesProfileId" TEXT NOT NULL,
"commentId" TEXT NOT NULL,
"value" INTEGER NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "ResumesCommentVote_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "ResumesProfile_userId_key" ON "ResumesProfile"("userId");
-- CreateIndex
CREATE UNIQUE INDEX "ResumesStar_resumeId_resumesProfileId_key" ON "ResumesStar"("resumeId", "resumesProfileId");
-- CreateIndex
CREATE UNIQUE INDEX "ResumesCommentVote_commentId_resumesProfileId_key" ON "ResumesCommentVote"("commentId", "resumesProfileId");
-- AddForeignKey
ALTER TABLE "ResumesProfile" ADD CONSTRAINT "ResumesProfile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ResumesResume" ADD CONSTRAINT "ResumesResume_resumesProfileId_fkey" FOREIGN KEY ("resumesProfileId") REFERENCES "ResumesProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ResumesStar" ADD CONSTRAINT "ResumesStar_resumesProfileId_fkey" FOREIGN KEY ("resumesProfileId") REFERENCES "ResumesProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ResumesStar" ADD CONSTRAINT "ResumesStar_resumeId_fkey" FOREIGN KEY ("resumeId") REFERENCES "ResumesResume"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ResumesComment" ADD CONSTRAINT "ResumesComment_resumesProfileId_fkey" FOREIGN KEY ("resumesProfileId") REFERENCES "ResumesProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ResumesComment" ADD CONSTRAINT "ResumesComment_resumeId_fkey" FOREIGN KEY ("resumeId") REFERENCES "ResumesResume"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ResumesCommentVote" ADD CONSTRAINT "ResumesCommentVote_resumesProfileId_fkey" FOREIGN KEY ("resumesProfileId") REFERENCES "ResumesProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ResumesCommentVote" ADD CONSTRAINT "ResumesCommentVote_commentId_fkey" FOREIGN KEY ("commentId") REFERENCES "ResumesComment"("id") ON DELETE CASCADE ON UPDATE CASCADE;

@ -0,0 +1,74 @@
/*
Warnings:
- You are about to drop the column `userId` on the `ResumesComment` table. All the data in the column will be lost.
- You are about to drop the column `userId` on the `ResumesCommentVote` table. All the data in the column will be lost.
- You are about to drop the column `userId` on the `ResumesResume` table. All the data in the column will be lost.
- You are about to drop the column `userId` on the `ResumesStar` table. All the data in the column will be lost.
- A unique constraint covering the columns `[commentId,resumesProfileId]` on the table `ResumesCommentVote` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[resumeId,resumesProfileId]` on the table `ResumesStar` will be added. If there are existing duplicate values, this will fail.
- Added the required column `resumesProfileId` to the `ResumesComment` table without a default value. This is not possible if the table is not empty.
- Added the required column `resumesProfileId` to the `ResumesCommentVote` table without a default value. This is not possible if the table is not empty.
- Added the required column `resumesProfileId` to the `ResumesResume` table without a default value. This is not possible if the table is not empty.
- Added the required column `resumesProfileId` to the `ResumesStar` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "ResumesComment" DROP CONSTRAINT "ResumesComment_userId_fkey";
-- DropForeignKey
ALTER TABLE "ResumesCommentVote" DROP CONSTRAINT "ResumesCommentVote_userId_fkey";
-- DropForeignKey
ALTER TABLE "ResumesResume" DROP CONSTRAINT "ResumesResume_userId_fkey";
-- DropForeignKey
ALTER TABLE "ResumesStar" DROP CONSTRAINT "ResumesStar_userId_fkey";
-- AlterTable
ALTER TABLE "ResumesComment" DROP COLUMN "userId",
ADD COLUMN "resumesProfileId" TEXT NOT NULL;
-- AlterTable
ALTER TABLE "ResumesCommentVote" DROP COLUMN "userId",
ADD COLUMN "resumesProfileId" TEXT NOT NULL;
-- AlterTable
ALTER TABLE "ResumesResume" DROP COLUMN "userId",
ADD COLUMN "resumesProfileId" TEXT NOT NULL;
-- AlterTable
ALTER TABLE "ResumesStar" DROP COLUMN "userId",
ADD COLUMN "resumesProfileId" TEXT NOT NULL;
-- CreateTable
CREATE TABLE "ResumesProfile" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
CONSTRAINT "ResumesProfile_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "ResumesProfile_userId_key" ON "ResumesProfile"("userId");
-- CreateIndex
CREATE UNIQUE INDEX "ResumesCommentVote_commentId_resumesProfileId_key" ON "ResumesCommentVote"("commentId", "resumesProfileId");
-- CreateIndex
CREATE UNIQUE INDEX "ResumesStar_resumeId_resumesProfileId_key" ON "ResumesStar"("resumeId", "resumesProfileId");
-- AddForeignKey
ALTER TABLE "ResumesProfile" ADD CONSTRAINT "ResumesProfile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ResumesResume" ADD CONSTRAINT "ResumesResume_resumesProfileId_fkey" FOREIGN KEY ("resumesProfileId") REFERENCES "ResumesProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ResumesStar" ADD CONSTRAINT "ResumesStar_resumesProfileId_fkey" FOREIGN KEY ("resumesProfileId") REFERENCES "ResumesProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ResumesComment" ADD CONSTRAINT "ResumesComment_resumesProfileId_fkey" FOREIGN KEY ("resumesProfileId") REFERENCES "ResumesProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ResumesCommentVote" ADD CONSTRAINT "ResumesCommentVote_resumesProfileId_fkey" FOREIGN KEY ("resumesProfileId") REFERENCES "ResumesProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Loading…
Cancel
Save