Skip to content

Commit

Permalink
editoast: remove tables
Browse files Browse the repository at this point in the history
  • Loading branch information
younesschrifi committed Aug 28, 2024
1 parent 17fa414 commit e2c7dbf
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 106 deletions.
65 changes: 65 additions & 0 deletions editoast/migrations/2024-08-13-140358_delete_tsv1_tables/down.sql
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
);
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;
106 changes: 0 additions & 106 deletions editoast/src/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,23 +409,6 @@ diesel::table! {
}
}

diesel::table! {
use diesel::sql_types::*;
use postgis_diesel::sql_types::*;

pathfinding (id) {
id -> Int8,
owner -> Uuid,
created -> Timestamptz,
payload -> Jsonb,
slopes -> Jsonb,
curves -> Jsonb,
geographic -> Geometry,
infra_id -> Int8,
length -> Float8,
}
}

diesel::table! {
use diesel::sql_types::*;
use postgis_diesel::sql_types::*;
Expand Down Expand Up @@ -507,26 +490,6 @@ diesel::table! {
}
}

diesel::table! {
use diesel::sql_types::*;
use postgis_diesel::sql_types::*;

scenario (id) {
id -> Int8,
#[max_length = 128]
name -> Varchar,
#[max_length = 1024]
description -> Varchar,
creation_date -> Timestamptz,
last_modification -> Timestamptz,
tags -> Array<Nullable<Text>>,
infra_id -> Int8,
timetable_id -> Int8,
study_id -> Int8,
electrical_profile_set_id -> Nullable<Int8>,
}
}

diesel::table! {
use diesel::sql_types::*;
use postgis_diesel::sql_types::*;
Expand Down Expand Up @@ -633,21 +596,6 @@ diesel::table! {
}
}

diesel::table! {
use diesel::sql_types::*;
use postgis_diesel::sql_types::*;

simulation_output (id) {
id -> Int8,
mrsp -> Jsonb,
base_simulation -> Jsonb,
eco_simulation -> Nullable<Jsonb>,
electrification_ranges -> Jsonb,
train_schedule_id -> Nullable<Int8>,
power_restriction_ranges -> Jsonb,
}
}

diesel::table! {
use diesel::sql_types::*;
use postgis_diesel::sql_types::*;
Expand Down Expand Up @@ -692,17 +640,6 @@ diesel::table! {
}
}

diesel::table! {
use diesel::sql_types::*;
use postgis_diesel::sql_types::*;

timetable (id) {
id -> Int8,
#[max_length = 128]
name -> Varchar,
}
}

diesel::table! {
use diesel::sql_types::*;
use postgis_diesel::sql_types::*;
Expand All @@ -712,34 +649,6 @@ diesel::table! {
}
}

diesel::table! {
use diesel::sql_types::*;
use postgis_diesel::sql_types::*;

train_schedule (id) {
id -> Int8,
#[max_length = 128]
train_name -> Varchar,
labels -> Jsonb,
departure_time -> Float8,
initial_speed -> Float8,
allowances -> Jsonb,
#[max_length = 8]
comfort -> Varchar,
#[max_length = 128]
speed_limit_tags -> Nullable<Varchar>,
power_restriction_ranges -> Nullable<Jsonb>,
options -> Nullable<Jsonb>,
path_id -> Int8,
rolling_stock_id -> Int8,
timetable_id -> Int8,
scheduled_points -> Jsonb,
#[max_length = 40]
infra_version -> Varchar,
rollingstock_version -> Int8,
}
}

diesel::table! {
use diesel::sql_types::*;
use postgis_diesel::sql_types::*;
Expand Down Expand Up @@ -822,34 +731,24 @@ diesel::joinable!(infra_object_signal -> infra (infra_id));
diesel::joinable!(infra_object_speed_section -> infra (infra_id));
diesel::joinable!(infra_object_switch -> infra (infra_id));
diesel::joinable!(infra_object_track_section -> infra (infra_id));
diesel::joinable!(pathfinding -> infra (infra_id));
diesel::joinable!(project -> document (image_id));
diesel::joinable!(rolling_stock_livery -> document (compound_image_id));
diesel::joinable!(rolling_stock_livery -> rolling_stock (rolling_stock_id));
diesel::joinable!(rolling_stock_separate_image -> document (image_id));
diesel::joinable!(rolling_stock_separate_image -> rolling_stock_livery (livery_id));
diesel::joinable!(scenario -> electrical_profile_set (electrical_profile_set_id));
diesel::joinable!(scenario -> infra (infra_id));
diesel::joinable!(scenario -> study (study_id));
diesel::joinable!(scenario -> timetable (timetable_id));
diesel::joinable!(scenario_v2 -> electrical_profile_set (electrical_profile_set_id));
diesel::joinable!(scenario_v2 -> infra (infra_id));
diesel::joinable!(scenario_v2 -> study (study_id));
diesel::joinable!(scenario_v2 -> timetable_v2 (timetable_id));
diesel::joinable!(search_operational_point -> infra_object_operational_point (id));
diesel::joinable!(search_project -> project (id));
diesel::joinable!(search_scenario -> scenario (id));
diesel::joinable!(search_signal -> infra_object_signal (id));
diesel::joinable!(search_study -> study (id));
diesel::joinable!(simulation_output -> train_schedule (train_schedule_id));
diesel::joinable!(stdcm_search_environment -> electrical_profile_set (electrical_profile_set_id));
diesel::joinable!(stdcm_search_environment -> infra (infra_id));
diesel::joinable!(stdcm_search_environment -> timetable_v2 (timetable_id));
diesel::joinable!(stdcm_search_environment -> work_schedule_group (work_schedule_group_id));
diesel::joinable!(study -> project (project_id));
diesel::joinable!(train_schedule -> pathfinding (path_id));
diesel::joinable!(train_schedule -> rolling_stock (rolling_stock_id));
diesel::joinable!(train_schedule -> timetable (timetable_id));
diesel::joinable!(train_schedule_v2 -> timetable_v2 (timetable_id));
diesel::joinable!(work_schedule -> work_schedule_group (work_schedule_group_id));

Expand Down Expand Up @@ -885,25 +784,20 @@ diesel::allow_tables_to_appear_in_same_query!(
infra_object_speed_section,
infra_object_switch,
infra_object_track_section,
pathfinding,
project,
rolling_stock,
rolling_stock_livery,
rolling_stock_separate_image,
scenario,
scenario_v2,
search_operational_point,
search_project,
search_scenario,
search_signal,
search_study,
search_track,
simulation_output,
stdcm_search_environment,
study,
timetable,
timetable_v2,
train_schedule,
train_schedule_v2,
work_schedule,
work_schedule_group,
Expand Down

0 comments on commit e2c7dbf

Please sign in to comment.