--- personal-managers

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

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

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

CREATE SEQUENCE personal_managers_id_seq;

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