/* Warnings: - The primary key for the `ConversationParticipant` table will be changed. If it partially fails, the table could be left without primary key constraint. - The required column `id` was added to the `ConversationParticipant` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. */ -- RedefineTables PRAGMA defer_foreign_keys=ON; PRAGMA foreign_keys=OFF; CREATE TABLE "new_ConversationParticipant" ( "id" TEXT NOT NULL PRIMARY KEY, "conversationId" TEXT NOT NULL, "userId" TEXT NOT NULL, "lastReadAt" DATETIME, CONSTRAINT "ConversationParticipant_conversationId_fkey" FOREIGN KEY ("conversationId") REFERENCES "Conversation" ("id") ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT "ConversationParticipant_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE ); INSERT INTO "new_ConversationParticipant" ("conversationId", "lastReadAt", "userId") SELECT "conversationId", "lastReadAt", "userId" FROM "ConversationParticipant"; DROP TABLE "ConversationParticipant"; ALTER TABLE "new_ConversationParticipant" RENAME TO "ConversationParticipant"; CREATE INDEX "ConversationParticipant_userId_idx" ON "ConversationParticipant"("userId"); CREATE UNIQUE INDEX "ConversationParticipant_conversationId_userId_key" ON "ConversationParticipant"("conversationId", "userId"); PRAGMA foreign_keys=ON; PRAGMA defer_foreign_keys=OFF;