rgncycle-db/sql/create-relations-table.sql

12 lines
369 B
MySQL
Raw Normal View History

2023-03-15 14:30:41 +01:00
---
DROP TABLE IF EXISTS relations;
---
CREATE TABLE IF NOT EXISTS relations(
id BIGSERIAL PRIMARY KEY,
relation_role BIGINT NOT NULL,
from_entity BIGINT NOT NULL,
to_entity BIGINT NOT NULL,
FOREIGN KEY(relation_role) REFERENCES relation_roles(id),
FOREIGN KEY(to_entity) REFERENCES entities(id),
FOREIGN KEY(from_entity) REFERENCES entities(id));