CREATE TABLE system_chats_settings (
    id BIGINT PRIMARY KEY,
    project_id BIGINT NOT NULL REFERENCES projects(id),
    message varchar(1024),
    lifetime BIGINT,
    enabled BOOLEAN,
    deleted BOOLEAN,

    created_at TIMESTAMP WITH TIME ZONE NOT NULL,
    updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
    deleted_at TIMESTAMP WITH TIME ZONE
);

CREATE SEQUENCE system_chats_settings_id_seq;

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