START TRANSACTION;

CREATE TABLE IF NOT EXISTS campaign_service_resource_preset
(
    campaign_id BIGSERIAL NOT NULL REFERENCES campaign (id) ON DELETE CASCADE ON UPDATE CASCADE,
    service_id  BIGSERIAL NOT NULL REFERENCES service (id) ON DELETE CASCADE ON UPDATE CASCADE,
    preset      JSONB     NOT NULL,
    PRIMARY KEY (campaign_id, service_id)
);

CREATE INDEX IF NOT EXISTS campaign_service_resource_preset_camapgin_id_idx ON campaign_service_resource_preset (campaign_id);

COMMIT;
