create table if not exists credentials ( id uuid primary key default gen_random_uuid(), user_id uuid not null references users(id) on delete cascade, site_origin text not null, username text not null, password_enc text not null, password_iv text not null, password_tag text not null, created_at timestamptz not null default now(), updated_at timestamptz not null default now() ); create unique index if not exists idx_credentials_user_origin_username on credentials (user_id, site_origin, username); create index if not exists idx_credentials_user_origin on credentials (user_id, site_origin);