CREATE TABLE bonus_stores
(
    bonus_id  BIGINT NOT NULL,
    stores_id BIGINT NOT NULL
);

CREATE TABLE store_bonuses
(
    store_id   BIGINT NOT NULL,
    bonuses_id BIGINT NOT NULL
);

ALTER TABLE bonus_stores
    ADD CONSTRAINT fk_bonsto_on_bonus FOREIGN KEY (bonus_id) REFERENCES bonus (id);

ALTER TABLE bonus_stores
    ADD CONSTRAINT fk_bonsto_on_store FOREIGN KEY (stores_id) REFERENCES store (id);

ALTER TABLE store_bonuses
    ADD CONSTRAINT fk_stobon_on_bonus FOREIGN KEY (bonuses_id) REFERENCES bonus (id);

ALTER TABLE store_bonuses
    ADD CONSTRAINT fk_stobon_on_store FOREIGN KEY (store_id) REFERENCES store (id);