Files
documenso/packages/prisma/migrations/20250104024352_add_user_secondary_id/migration.sql
David Nguyen 071ce70292 wip: test
2025-01-05 15:45:51 +11:00

12 lines
380 B
SQL

-- AlterTable
ALTER TABLE "User" ADD COLUMN "secondaryId" TEXT;
-- Set all null secondaryId fields to a uuid
UPDATE "User" SET "secondaryId" = gen_random_uuid()::text WHERE "secondaryId" IS NULL;
-- Restrict the User to required
ALTER TABLE "User" ALTER COLUMN "secondaryId" SET NOT NULL;
-- CreateIndex
CREATE UNIQUE INDEX "User_secondaryId_key" ON "User"("secondaryId");