Files
workout-cool/prisma/migrations/20250505191954_admin_and_user_lowercase/migration.sql
T
2025-06-11 15:23:25 +02:00

20 lines
641 B
PL/PgSQL

/*
Warnings:
- The values [ADMIN,USER] on the enum `UserRole` will be removed. If these variants are still used in the database, this will fail.
*/
-- AlterEnum
BEGIN;
CREATE TYPE "UserRole_new" AS ENUM ('admin', 'user');
ALTER TABLE "user" ALTER COLUMN "role" DROP DEFAULT;
ALTER TABLE "user" ALTER COLUMN "role" TYPE "UserRole_new" USING ("role"::text::"UserRole_new");
ALTER TYPE "UserRole" RENAME TO "UserRole_old";
ALTER TYPE "UserRole_new" RENAME TO "UserRole";
DROP TYPE "UserRole_old";
ALTER TABLE "user" ALTER COLUMN "role" SET DEFAULT 'user';
COMMIT;
-- AlterTable
ALTER TABLE "user" ALTER COLUMN "role" SET DEFAULT 'user';