/*
  Warnings:

  - The values [user] on the enum `ORG_ROLE` will be removed. If these variants are still used in the database, this will fail.
  - The values [ordinary] on the enum `USER_ROLE` will be removed. If these variants are still used in the database, this will fail.

*/

-- AlterEnum
BEGIN;
CREATE TYPE "ORG_ROLE_new" AS ENUM ('owner', 'admin', 'member');
ALTER TABLE "public"."organization_user_join" ALTER COLUMN "role" DROP DEFAULT;
ALTER TABLE "organization_user_join" ALTER COLUMN "role" TYPE "ORG_ROLE_new" USING ("role"::text::"ORG_ROLE_new");
ALTER TYPE "ORG_ROLE" RENAME TO "ORG_ROLE_old";
ALTER TYPE "ORG_ROLE_new" RENAME TO "ORG_ROLE";
DROP TYPE "public"."ORG_ROLE_old";
ALTER TABLE "organization_user_join" ALTER COLUMN "role" SET DEFAULT 'member';
COMMIT;

-- AlterEnum
BEGIN;
CREATE TYPE "USER_ROLE_new" AS ENUM ('superadmin', 'user');
ALTER TABLE "public"."user" ALTER COLUMN "role" DROP DEFAULT;
ALTER TABLE "user" ALTER COLUMN "role" TYPE "USER_ROLE_new" USING ("role"::text::"USER_ROLE_new");
ALTER TYPE "USER_ROLE" RENAME TO "USER_ROLE_old";
ALTER TYPE "USER_ROLE_new" RENAME TO "USER_ROLE";
DROP TYPE "public"."USER_ROLE_old";
ALTER TABLE "user" ALTER COLUMN "role" SET DEFAULT 'user';
COMMIT;

-- AlterTable
ALTER TABLE "organization_user_join" ALTER COLUMN "role" SET DEFAULT 'member';

-- AlterTable
ALTER TABLE "user" ALTER COLUMN "role" SET DEFAULT 'user';
