-- Deploy tipus:user to pg
-- requires: schema_auth
-- requires: email
-- requires: language

begin;

set search_path to auth, tipus, public;

create table "user"
(
    user_id           serial primary key,
    email             email       not null unique,
    name              text        not null,
    password          text        not null check (length(password) < 512),
    role              name        not null check (length(role) < 512),
    lang_tag          text        not null default 'und' references language,
    cookie            text        not null default '',
    cookie_expires_at timestamptz not null default '-infinity'::timestamp,
    created_at        timestamptz not null default current_timestamp
);

commit;