36782-vm/db/migrations/021_create_product_relations_table.sql
2025-12-12 14:13:03 +00:00

7 lines
316 B
SQL

CREATE TABLE IF NOT EXISTS product_relations (
product_id INT NOT NULL,
related_product_id INT NOT NULL,
PRIMARY KEY (product_id, related_product_id),
FOREIGN KEY (product_id) REFERENCES products(id) ON DELETE CASCADE,
FOREIGN KEY (related_product_id) REFERENCES products(id) ON DELETE CASCADE
);