/* Warnings: - The primary key for the `TourParticipant` table will be changed. If it partially fails, the table could be left without primary key constraint. - A unique constraint covering the columns `[tourId,userId]` on the table `TourParticipant` will be added. If there are existing duplicate values, this will fail. - The required column `id` was added to the `TourParticipant` 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. */ -- AlterTable ALTER TABLE "TourParticipant" DROP CONSTRAINT "TourParticipant_pkey", ADD COLUMN "displayName" TEXT, ADD COLUMN "id" TEXT; UPDATE "TourParticipant" SET "id" = md5(random()::text); ALTER TABLE "TourParticipant" ALTER COLUMN "id" SET NOT NULL, ALTER COLUMN "userId" DROP NOT NULL; ALTER TABLE "TourParticipant" ADD CONSTRAINT "TourParticipant_pkey" PRIMARY KEY ("id"); -- CreateIndex CREATE UNIQUE INDEX "TourParticipant_tourId_userId_key" ON "TourParticipant"("tourId", "userId");