Last active
April 10, 2021 04:05
-
-
Save Tycholiz/bd28263777e250038144d81ba8e3b8de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- The enum way | |
create type app_public.role_types as enum ( | |
'READER', | |
'PUBLISHER' | |
); | |
create table app_public.roles ( | |
id uuid primary key, | |
title app_public.role_types | |
); | |
insert into app_public.roles (title) values ('READER') | |
insert into app_public.roles (title) values ('PUBLISHER') | |
insert into app_public.roles (title) values ('CURATOR') -- error: ain't no CURATOR on an app_public.role_types | |
alter type app_public.role_types add value 'CURATOR'; | |
insert into app_public.roles (title) values ('CURATOR') -- all good! | |
-- The text way | |
create table app_public.roles ( | |
id uuid primary key, | |
title text | |
); | |
insert into app_public.roles (title) values ('READER') | |
insert into app_public.roles (title) values ('PUBLISHER') | |
insert into app_public.roles (title) values ('CURATOR') | |
insert into app_public.roles (title) values ('CURRATOR') -- whoops, my clumsy fingers mispelled this and now what? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment