--- personal-managers

ALTER TABLE chats ADD "type" VARCHAR(32);
UPDATE chats SET "type" = 'regular';

DROP INDEX chats_channel_id_client_id_uniq;
CREATE UNIQUE INDEX chats_type_channel_client_uniq ON chats ("type", channel_id, client_id);

CREATE TABLE personal_managers (
    id        BIGSERIAL PRIMARY KEY,
    user_id   BIGINT NOT NULL REFERENCES users(id),
    client_id BIGINT NOT NULL REFERENCES clients(id)
);

CREATE UNIQUE INDEX personal_managers_user_client_uniq ON personal_managers (user_id, client_id);
