From afe9ba1956c7145f5e4bdc5d72a168c162623fd4 Mon Sep 17 00:00:00 2001 From: EugeneTes Date: Sat, 15 Aug 2026 11:23:40 +0000 Subject: [PATCH] Add todos table migration --- migrations/001_create_todos.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 migrations/001_create_todos.sql 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);