Skip to content

Commit

Permalink
editoast: add new tables
Browse files Browse the repository at this point in the history
  • Loading branch information
younesschrifi committed Feb 1, 2024
1 parent ff17ab1 commit 698c5c1
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DROP TABLE scenariov2;
DROP TABLE trainschedulev2;
DROP TABLE timetablev2;
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
CREATE TABLE timetablev2 (
id int8 PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
infra_id int8 NOT NULL REFERENCES infra(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
electrical_profile_set_id int8 NULL REFERENCES electrical_profile_set(id) ON DELETE CASCADE
);
CREATE TABLE scenariov2 (
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,
timetable_id int8 NOT NULL UNIQUE REFERENCES timetablev2(id) DEFERRABLE INITIALLY DEFERRED,
study_id int8 NOT NULL REFERENCES study(id) ON DELETE CASCADE
);
CREATE TABLE trainschedulev2 (
id int8 PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
train_name varchar(128) NOT NULL,
labels jsonb NOT NULL,
rolling_stock_id int8 NOT NULL REFERENCES rolling_stock(id) ON DELETE CASCADE,
timetable_id int8 NOT NULL UNIQUE REFERENCES timetablev2(id) DEFERRABLE INITIALLY DEFERRED,
departure_time float8 NOT NULL,
scheduled_points jsonb NOT NULL,
allowances jsonb NOT NULL,
initial_speed float8 NOT NULL,
comfort varchar(8) NOT NULL,
speed_limit_tags varchar(128) NULL,
power_restriction_ranges jsonb NULL,
options jsonb NULL
);
62 changes: 62 additions & 0 deletions editoast/src/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,24 @@ diesel::table! {
}
}

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

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

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

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

timetablev2 (id) {
id -> Int8,
infra_id -> Int8,
electrical_profile_set_id -> Nullable<Int8>,
}
}

diesel::table! {
use diesel::sql_types::*;
use postgis_diesel::sql_types::*;
Expand Down Expand Up @@ -642,6 +671,30 @@ diesel::table! {
}
}

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

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

diesel::joinable!(infra_layer_buffer_stop -> infra (infra_id));
diesel::joinable!(infra_layer_detector -> infra (infra_id));
diesel::joinable!(infra_layer_electrification -> infra (infra_id));
Expand Down Expand Up @@ -674,16 +727,22 @@ 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!(scenariov2 -> study (study_id));
diesel::joinable!(scenariov2 -> timetablev2 (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!(study -> project (project_id));
diesel::joinable!(timetablev2 -> electrical_profile_set (electrical_profile_set_id));
diesel::joinable!(timetablev2 -> infra (infra_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!(trainschedulev2 -> rolling_stock (rolling_stock_id));
diesel::joinable!(trainschedulev2 -> timetablev2 (timetable_id));

diesel::allow_tables_to_appear_in_same_query!(
document,
Expand Down Expand Up @@ -717,6 +776,7 @@ diesel::allow_tables_to_appear_in_same_query!(
rolling_stock_livery,
rolling_stock_separate_image,
scenario,
scenariov2,
search_operational_point,
search_project,
search_scenario,
Expand All @@ -726,5 +786,7 @@ diesel::allow_tables_to_appear_in_same_query!(
simulation_output,
study,
timetable,
timetablev2,
train_schedule,
trainschedulev2,
);

0 comments on commit 698c5c1

Please sign in to comment.