Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sql/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,6 @@ DROP TABLE IF EXISTS ship_geometry, ship_parameters, ship CASCADE;
--
-- Initial ports data (moved to the bottom because after updating file something gone wrong)
\i ./sql/voyage/port_create.sql
--
-- Initial route points data
\i ./sql/voyage/route_point_create.sql
14 changes: 14 additions & 0 deletions sql/voyage/route_point_create.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
DROP TABLE IF EXISTS route_point;

CREATE TABLE IF NOT EXISTS route_point (
id INT GENERATED ALWAYS AS IDENTITY, -- ID of the route point
pol_id INT NOT NULL, -- ID of the POL (Point Of Loading)
pod_id INT NOT NULL, -- ID of the POD (Point Of Discharge)
latitude FLOAT NOT NULL, -- Value of latitude
longitude FLOAT NOT NULL, -- Value of longitude
order INT NOT NULL, -- Order of route point
CONSTRAINT route_point_pk PRIMARY KEY (id),
CONSTRAINT route_point_pol_fk FOREIGN KEY (pol_id) REFERENCES waypoint (id),
CONSTRAINT route_point_pod_fk FOREIGN KEY (pod_id) REFERENCES waypoint (id),
CONSTRAINT unique_route_point_order UNIQUE (pol_id, pod_id, order)
);