Postgres에서 enum 만들기

Beaver Bridge - Jun 30 '23 - - Dev Community
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'UserRole') THEN
  CREATE TYPE "UserRole" AS ENUM ('USER', 'ADMIN', 'TEMP');
END IF;
END$$;
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . .