CREATE TABLE telegram_publics (
    id BIGINT IDENTITY (1, 1) primary key ,
    title NVARCHAR(125) not null,
    telegram_link NVARCHAR(512) not null,
    channel_id BIGINT references channels (id),
    [deleted] BIT NOT NULL,

    created_at DATETIMEOFFSET NOT NULL,
    updated_at DATETIMEOFFSET NOT NULL,
    deleted_at DATETIMEOFFSET
);

CREATE UNIQUE INDEX telegram_publics_uniq ON telegram_publics(telegram_link, channel_id) WHERE deleted = 0;
