START TRANSACTION;

DROP TABLE bot_service_configuration;

CREATE TABLE bot_service_configuration
(
    service_id           BIGINT NOT NULL REFERENCES service (id) ON UPDATE CASCADE ON DELETE CASCADE,
    bot_configuration_id BIGINT NOT NULL REFERENCES bot_configuration (id) ON UPDATE CASCADE ON DELETE CASCADE,
    location_segment_id  BIGINT NOT NULL REFERENCES segment (id) ON UPDATE CASCADE ON DELETE CASCADE,
    UNIQUE (service_id, bot_configuration_id, location_segment_id)
);

COMMIT;