-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
adc848a
commit 873f7e1
Showing
3 changed files
with
70 additions
and
106 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
editoast/migrations/2024-08-13-140358_delete_tsv1_tables/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
-- This file should undo anything in `up.sql` | ||
|
||
|
||
CREATE TABLE pathfinding ( | ||
id int8 PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, | ||
"owner" uuid NOT NULL, | ||
created timestamptz NOT NULL, | ||
payload jsonb NOT NULL, | ||
slopes jsonb NOT NULL, | ||
curves jsonb NOT NULL, | ||
geographic geometry(linestring, 4326) NOT NULL, | ||
schematic geometry(linestring, 4326) NOT NULL, | ||
infra_id int8 NOT NULL, | ||
length float8 NOT NULL, | ||
CONSTRAINT pathfinding_fkey FOREIGN KEY (infra_id) REFERENCES infra(id) ON DELETE CASCADE | ||
); | ||
|
||
CREATE TABLE timetable ( | ||
id int8 PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, | ||
name varchar(128) NOT NULL | ||
); | ||
|
||
CREATE TABLE scenario ( | ||
id int8 PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, | ||
name varchar(128) NOT NULL, | ||
description varchar(1024) NOT NULL, | ||
creation_date timestamptz NOT NULL, | ||
last_modification timestamptz NOT NULL, | ||
tags text[] NOT NULL, | ||
infra_id int8 NOT NULL REFERENCES infra(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, | ||
timetable_id int8 NOT NULL UNIQUE REFERENCES timetable(id) DEFERRABLE INITIALLY DEFERRED, | ||
study_id int8 NOT NULL REFERENCES study(id) ON DELETE CASCADE, | ||
electrical_profile_set_id int8 NULL REFERENCES electrical_profile_set(id) ON DELETE CASCADE | ||
); | ||
CREATE INDEX scenario_infra_id ON scenario USING btree (infra_id); | ||
|
||
CREATE TABLE simulation_output ( | ||
id int8 PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, | ||
mrsp jsonb NOT NULL, | ||
base_simulation jsonb NOT NULL, | ||
eco_simulation jsonb NULL, | ||
electrification_ranges jsonb NOT NULL, | ||
train_schedule_id int8 NULL UNIQUE REFERENCES train_schedule(id) ON DELETE CASCADE, | ||
power_restriction_ranges jsonb NOT NULL | ||
); | ||
|
||
|
||
CREATE TABLE train_schedule ( | ||
id int8 PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, | ||
train_name varchar(128) NOT NULL, | ||
labels jsonb NOT NULL, | ||
departure_time float8 NOT NULL, | ||
initial_speed float8 NOT NULL, | ||
allowances jsonb NOT NULL, | ||
comfort varchar(8) NOT NULL, | ||
speed_limit_tags varchar(128) NULL, | ||
power_restriction_ranges jsonb NULL, | ||
options jsonb NULL, | ||
path_id int8 NOT NULL REFERENCES pathfinding(id) ON DELETE CASCADE, | ||
rolling_stock_id int8 NOT NULL REFERENCES rolling_stock(id) ON DELETE CASCADE, | ||
timetable_id int8 NOT NULL REFERENCES timetable(id) ON DELETE CASCADE, | ||
scheduled_points jsonb NOT NULL, | ||
infra_version varchar(40) NOT NULL, | ||
rollingstock_version int8 NOT NULL | ||
); |
5 changes: 5 additions & 0 deletions
5
editoast/migrations/2024-08-13-140358_delete_tsv1_tables/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DROP TABLE scenario CASCADE; | ||
DROP TABLE simulation_output; | ||
DROP TABLE timetable CASCADE; | ||
DROP TABLE pathfinding CASCADE; | ||
DROP TABLE train_schedule CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters