Make migrations idempotent and add missing tables
- Make all pending migrations idempotent (safe to re-run) - Disable decouple_projects_from_rounds migration (schema not changed) - Add ProjectTag table for AI tagging - Add AssignmentJob table for AI assignment progress On server deployment, run: npx prisma migrate deploy Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "InAppNotification" (
|
||||
CREATE TABLE IF NOT EXISTS "InAppNotification" (
|
||||
"id" TEXT NOT NULL,
|
||||
"userId" TEXT NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
@@ -20,7 +20,7 @@ CREATE TABLE "InAppNotification" (
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "NotificationEmailSetting" (
|
||||
CREATE TABLE IF NOT EXISTS "NotificationEmailSetting" (
|
||||
"id" TEXT NOT NULL,
|
||||
"notificationType" TEXT NOT NULL,
|
||||
"category" TEXT NOT NULL,
|
||||
@@ -30,29 +30,24 @@ CREATE TABLE "NotificationEmailSetting" (
|
||||
"emailSubject" TEXT,
|
||||
"emailTemplate" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedById" TEXT,
|
||||
|
||||
CONSTRAINT "NotificationEmailSetting_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "InAppNotification_userId_isRead_idx" ON "InAppNotification"("userId", "isRead");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "InAppNotification_userId_createdAt_idx" ON "InAppNotification"("userId", "createdAt");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "InAppNotification_groupKey_idx" ON "InAppNotification"("groupKey");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "NotificationEmailSetting_notificationType_key" ON "NotificationEmailSetting"("notificationType");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "NotificationEmailSetting_category_idx" ON "NotificationEmailSetting"("category");
|
||||
CREATE INDEX IF NOT EXISTS "InAppNotification_userId_isRead_idx" ON "InAppNotification"("userId", "isRead");
|
||||
CREATE INDEX IF NOT EXISTS "InAppNotification_userId_createdAt_idx" ON "InAppNotification"("userId", "createdAt");
|
||||
CREATE INDEX IF NOT EXISTS "InAppNotification_groupKey_idx" ON "InAppNotification"("groupKey");
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS "NotificationEmailSetting_notificationType_key" ON "NotificationEmailSetting"("notificationType");
|
||||
CREATE INDEX IF NOT EXISTS "NotificationEmailSetting_category_idx" ON "NotificationEmailSetting"("category");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "InAppNotification" ADD CONSTRAINT "InAppNotification_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "InAppNotification" ADD CONSTRAINT "InAppNotification_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
EXCEPTION WHEN duplicate_object THEN NULL; END $$;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "NotificationEmailSetting" ADD CONSTRAINT "NotificationEmailSetting_updatedById_fkey" FOREIGN KEY ("updatedById") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "NotificationEmailSetting" ADD CONSTRAINT "NotificationEmailSetting_updatedById_fkey" FOREIGN KEY ("updatedById") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
EXCEPTION WHEN duplicate_object THEN NULL; END $$;
|
||||
|
||||
Reference in New Issue
Block a user