--- webhook-endpoints

create table webhooks (
    id bigint primary key,
    project_id bigint not null references projects(id),
    type varchar(64) not null,
    title varchar(64) not null,
    description varchar(255) not null,
    url varchar(255) not null,

    enabled boolean not null,
    deleted boolean not null,

    created_at timestamp with time zone not null,
    updated_at timestamp with time zone not null,
    deleted_at timestamp with time zone
);

create sequence webhooks_id_seq;

create unique index webhooks_uniq 
on webhooks(project_id, lower(title))
where deleted = FALSE;
