Last active
October 1, 2021 04:00
-
-
Save jasonho-lynx/11cb9e30e8314462519a4215e12c0a6c 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
-- users table | |
CREATE TABLE public.users ( | |
id UUID PRIMARY KEY, | |
email TEXT, | |
created_at TIMESTAMP WITH TIME ZONE | |
); | |
-- table to store files that users create | |
CREATE TABLE public.files ( | |
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY, | |
data TEXT | |
); | |
-- table that records file permissions that users have. | |
-- role_name can be Owner, Editor, or Viewer | |
CREATE TABLE public.file_access ( | |
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY, | |
file_id UUID REFERENCES public.files, | |
user_id UUID REFERENCES public.users, | |
role_name TEXT | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment