Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add todo table #241

Merged
merged 1 commit into from
Dec 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions db/setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ drop index if exists gist_owner_idx;
drop table if exists public.user;
drop table if exists public.session;
drop table if exists public.gist;
drop table if exists public.todo;

drop function if exists public.get_user;
drop function if exists public.gist_create;
Expand Down Expand Up @@ -41,12 +42,21 @@ create table public.gist (
deleted_at timestamptz
);

create table public.todo (
uid uuid default extensions.uuid_generate_v4() not null primary key,
created_at timestamptz default now(),
guestid uuid not null,
text text,
done boolean
);

-- foreign key relations
alter table public.gist add constraint gist_userid_fkey foreign key (userid) references public.user (id);
alter table public.session add constraint session_userid_fkey foreign key (userid) references public.user (id);

-- indexes
create index gist_owner_idx on public.gist using btree (userid);
create index todo_owner_idx on public.todo using btree (guestid);

-- functions
create or replace function public.get_user (sessionid uuid)
Expand Down