mirror of
https://github.com/massbug/judge4c.git
synced 2026-05-20 13:18:52 +00:00
20 lines
620 B
PL/PgSQL
20 lines
620 B
PL/PgSQL
/*
|
|
Warnings:
|
|
|
|
- The values [GUEST] on the enum `Role` will be removed. If these variants are still used in the database, this will fail.
|
|
|
|
*/
|
|
-- AlterEnum
|
|
BEGIN;
|
|
CREATE TYPE "Role_new" AS ENUM ('ADMIN', 'STUDENT', 'TEACHER');
|
|
ALTER TABLE "User" ALTER COLUMN "role" DROP DEFAULT;
|
|
ALTER TABLE "User" ALTER COLUMN "role" TYPE "Role_new" USING ("role"::text::"Role_new");
|
|
ALTER TYPE "Role" RENAME TO "Role_old";
|
|
ALTER TYPE "Role_new" RENAME TO "Role";
|
|
DROP TYPE "Role_old";
|
|
ALTER TABLE "User" ALTER COLUMN "role" SET DEFAULT 'STUDENT';
|
|
COMMIT;
|
|
|
|
-- AlterTable
|
|
ALTER TABLE "User" ALTER COLUMN "role" SET DEFAULT 'STUDENT';
|