-- DropForeignKey ALTER TABLE "ConflictOfInterest" DROP CONSTRAINT "ConflictOfInterest_roundId_fkey"; -- DropForeignKey ALTER TABLE "Project" DROP CONSTRAINT "Project_programId_fkey"; -- DropForeignKey ALTER TABLE "TaggingJob" DROP CONSTRAINT "TaggingJob_roundId_fkey"; -- DropIndex DROP INDEX "DiscussionComment_discussionId_createdAt_idx"; -- DropIndex DROP INDEX "EvaluationDiscussion_status_idx"; -- DropIndex DROP INDEX "LiveVote_isAudienceVote_idx"; -- DropIndex DROP INDEX "Message_scheduledAt_idx"; -- DropIndex DROP INDEX "MessageRecipient_messageId_idx"; -- DropIndex DROP INDEX "MessageRecipient_userId_isRead_idx"; -- DropIndex DROP INDEX "Project_programId_roundId_idx"; -- DropIndex DROP INDEX "Project_roundId_idx"; -- DropIndex DROP INDEX "ProjectFile_projectId_roundId_idx"; -- DropIndex DROP INDEX "ProjectFile_roundId_idx"; -- DropIndex DROP INDEX "TaggingJob_roundId_idx"; -- DropIndex DROP INDEX "WebhookDelivery_createdAt_idx"; -- AlterTable ALTER TABLE "User" ADD COLUMN "roles" "UserRole"[] DEFAULT ARRAY[]::"UserRole"[]; -- Backfill: populate roles array from existing role column UPDATE "User" SET "roles" = ARRAY["role"]::"UserRole"[]; -- AddForeignKey ALTER TABLE "Project" ADD CONSTRAINT "Project_programId_fkey" FOREIGN KEY ("programId") REFERENCES "Program"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "MessageTemplate" ADD CONSTRAINT "MessageTemplate_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; -- RenameIndex ALTER INDEX "DeliberationVote_sessionId_juryMemberId_projectId_runoffRo_key" RENAME TO "DeliberationVote_sessionId_juryMemberId_projectId_runoffRou_key";