db/schema/020_user.sql
2023-06-11 11:35:33 -05:00

27 lines
866 B
SQL

select create_newtype_text('public.usr_tag');
create table public.usr
( id int not null primary key generated always as identity
, uid uuid not null default gen_random_uuid()
, deleted boolean not null default false
, tag public.usr_tag not null
, password public.hashed_text not null
, email public.email not null unique
);
select audit( 'public'
, 'usr'
, array[ row('tag', 'public.usr_tag')
, row('password', 'public.hashed_text')
, row('email', 'public.email')
] :: audited_column[]
, soft_delete => true
);
select immutable( 'public'
, 'usr'
, array[ 'id'
, 'uid'
]
);