11 lines
401 B
SQL
11 lines
401 B
SQL
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);
|