select create_newtype_text('public.usr_username'); 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 , username public.usr_username not null , password public.hashed_text not null , email public.email not null unique ); select setup_audit_and_soft_delete( 'public' , 'usr' , array[ row('username', 'public.usr_username') , row('password', 'public.hashed_text') , row('email', 'public.email') ] :: audited_column[] ); select mark_columns_immutable( 'public' , 'usr' , array[ 'id' , 'uid' ] );