--- webhook-endpoints

create table webhooks (
    id bigint identity(1, 1) primary key,
    project_id bigint not null references projects(id),
    [type] nvarchar(64) not null,
    title nvarchar(64) not null,
    title_lower as lower([title]),
    description nvarchar(255) not null,
    [url] nvarchar(255) not null,

    [enabled] bit not null,
    [deleted] bit not null,

    created_at datetimeoffset not null,
    updated_at datetimeoffset not null,
    deleted_at datetimeoffset
);

create unique index webhooks_uniq
on webhooks(project_id, title_lower)
where deleted = 0;
