generated from azures04/Base-REST-API
Add database DDL and server-side data access/service layers for transport domain. New SQL DDL files create transport_types, lines, stations, platforms and platform_lines tables (with FKs, indexes, spatial POINT column, CHECK constraints, and triggers to populate location). New repositories implement queries and CRUD for lines, stations, platforms and platform_lines (including distance/nearest-platform and accessibility queries). A transportService aggregates repo functions and exposes high-level operations (CRUD, station/line lookups, platform-line management and nearest-platform validation).
17 lines
671 B
SQL
17 lines
671 B
SQL
CREATE TABLE IF NOT EXISTS `platform_lines` (
|
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
`platformId` INT UNSIGNED NOT NULL,
|
|
`lineId` INT UNSIGNED NOT NULL,
|
|
`directionId` TINYINT UNSIGNED NOT NULL DEFAULT 0,
|
|
`orderInLine` SMALLINT UNSIGNED NOT NULL,
|
|
|
|
PRIMARY KEY (id),
|
|
UNIQUE KEY uq_platform_line_dir (platformId, lineId, directionId),
|
|
UNIQUE KEY uq_line_dir_order (lineId, directionId, orderInLine),
|
|
INDEX idx_pl_line (lineId),
|
|
|
|
CONSTRAINT fk_pl_platform FOREIGN KEY (platformId)
|
|
REFERENCES platforms(id) ON DELETE CASCADE,
|
|
CONSTRAINT fk_pl_line FOREIGN KEY (lineId)
|
|
REFERENCES `lines`(id) ON DELETE CASCADE
|
|
); |