mirror of
https://github.com/Snouzy/workout-cool.git
synced 2026-05-19 14:40:35 +00:00
20 lines
641 B
PL/PgSQL
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';
|