diff --git a/migrations/001_create_todos.sql b/migrations/001_create_todos.sql new file mode 100644 index 0000000..a3680a6 --- /dev/null +++ b/migrations/001_create_todos.sql @@ -0,0 +1,10 @@ +create table if not exists public.todos ( + id bigserial primary key, + user_id uuid not null, + title text not null check (length(title) between 1 and 500), + completed boolean not null default false, + created_at timestamptz not null default now() +); + +create index if not exists todos_user_id_created_at_idx + on public.todos (user_id, created_at desc);