CREATE TABLE system_chats_settings (
    id BIGINT PRIMARY KEY IDENTITY (1, 1),
    project_id BIGINT NOT NULL REFERENCES projects(id),
    message NVARCHAR(1024),
    lifetime BIGINT,
    enabled BIT,
    [deleted] BIT NOT NULL,

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

CREATE UNIQUE INDEX system_chats_settings_uniq ON system_chats_settings(project_id, id) WHERE deleted = 0;
