create table wait_tickets(
                             ticket_id NUMBER(19) NOT NULL references tickets(id),
                             deleted NUMBER(1) not null,
                             user_id NUMBER(19) NOT NULL references users(id),
                             wait_until timestamp with time zone NOT NULL,
                             changed_at timestamp with time zone not null
);
create unique index wait_tickets_ticket_id on wait_tickets(ticket_id);

alter table tickets add (has_wait_ticket NUMBER(1), notify_wait_return NUMBER(1));;
