Skip to content

Commit 698c5c1

Browse files
committed
editoast: add new tables
1 parent ff17ab1 commit 698c5c1

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DROP TABLE scenariov2;
2+
DROP TABLE trainschedulev2;
3+
DROP TABLE timetablev2;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
CREATE TABLE timetablev2 (
2+
id int8 PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
3+
infra_id int8 NOT NULL REFERENCES infra(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
4+
electrical_profile_set_id int8 NULL REFERENCES electrical_profile_set(id) ON DELETE CASCADE
5+
);
6+
CREATE TABLE scenariov2 (
7+
id int8 PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
8+
name varchar(128) NOT NULL,
9+
description varchar(1024) NOT NULL,
10+
creation_date timestamptz NOT NULL,
11+
last_modification timestamptz NOT NULL,
12+
tags text [] NOT NULL,
13+
timetable_id int8 NOT NULL UNIQUE REFERENCES timetablev2(id) DEFERRABLE INITIALLY DEFERRED,
14+
study_id int8 NOT NULL REFERENCES study(id) ON DELETE CASCADE
15+
);
16+
CREATE TABLE trainschedulev2 (
17+
id int8 PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
18+
train_name varchar(128) NOT NULL,
19+
labels jsonb NOT NULL,
20+
rolling_stock_id int8 NOT NULL REFERENCES rolling_stock(id) ON DELETE CASCADE,
21+
timetable_id int8 NOT NULL UNIQUE REFERENCES timetablev2(id) DEFERRABLE INITIALLY DEFERRED,
22+
departure_time float8 NOT NULL,
23+
scheduled_points jsonb NOT NULL,
24+
allowances jsonb NOT NULL,
25+
initial_speed float8 NOT NULL,
26+
comfort varchar(8) NOT NULL,
27+
speed_limit_tags varchar(128) NULL,
28+
power_restriction_ranges jsonb NULL,
29+
options jsonb NULL
30+
);

editoast/src/tables.rs

+62
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,24 @@ diesel::table! {
471471
}
472472
}
473473

474+
diesel::table! {
475+
use diesel::sql_types::*;
476+
use postgis_diesel::sql_types::*;
477+
478+
scenariov2 (id) {
479+
id -> Int8,
480+
#[max_length = 128]
481+
name -> Varchar,
482+
#[max_length = 1024]
483+
description -> Varchar,
484+
creation_date -> Timestamptz,
485+
last_modification -> Timestamptz,
486+
tags -> Array<Nullable<Text>>,
487+
timetable_id -> Int8,
488+
study_id -> Int8,
489+
}
490+
}
491+
474492
diesel::table! {
475493
use diesel::sql_types::*;
476494
use postgis_diesel::sql_types::*;
@@ -614,6 +632,17 @@ diesel::table! {
614632
}
615633
}
616634

635+
diesel::table! {
636+
use diesel::sql_types::*;
637+
use postgis_diesel::sql_types::*;
638+
639+
timetablev2 (id) {
640+
id -> Int8,
641+
infra_id -> Int8,
642+
electrical_profile_set_id -> Nullable<Int8>,
643+
}
644+
}
645+
617646
diesel::table! {
618647
use diesel::sql_types::*;
619648
use postgis_diesel::sql_types::*;
@@ -642,6 +671,30 @@ diesel::table! {
642671
}
643672
}
644673

674+
diesel::table! {
675+
use diesel::sql_types::*;
676+
use postgis_diesel::sql_types::*;
677+
678+
trainschedulev2 (id) {
679+
id -> Int8,
680+
#[max_length = 128]
681+
train_name -> Varchar,
682+
labels -> Jsonb,
683+
rolling_stock_id -> Int8,
684+
timetable_id -> Int8,
685+
departure_time -> Float8,
686+
scheduled_points -> Jsonb,
687+
allowances -> Jsonb,
688+
initial_speed -> Float8,
689+
#[max_length = 8]
690+
comfort -> Varchar,
691+
#[max_length = 128]
692+
speed_limit_tags -> Nullable<Varchar>,
693+
power_restriction_ranges -> Nullable<Jsonb>,
694+
options -> Nullable<Jsonb>,
695+
}
696+
}
697+
645698
diesel::joinable!(infra_layer_buffer_stop -> infra (infra_id));
646699
diesel::joinable!(infra_layer_detector -> infra (infra_id));
647700
diesel::joinable!(infra_layer_electrification -> infra (infra_id));
@@ -674,16 +727,22 @@ diesel::joinable!(scenario -> electrical_profile_set (electrical_profile_set_id)
674727
diesel::joinable!(scenario -> infra (infra_id));
675728
diesel::joinable!(scenario -> study (study_id));
676729
diesel::joinable!(scenario -> timetable (timetable_id));
730+
diesel::joinable!(scenariov2 -> study (study_id));
731+
diesel::joinable!(scenariov2 -> timetablev2 (timetable_id));
677732
diesel::joinable!(search_operational_point -> infra_object_operational_point (id));
678733
diesel::joinable!(search_project -> project (id));
679734
diesel::joinable!(search_scenario -> scenario (id));
680735
diesel::joinable!(search_signal -> infra_object_signal (id));
681736
diesel::joinable!(search_study -> study (id));
682737
diesel::joinable!(simulation_output -> train_schedule (train_schedule_id));
683738
diesel::joinable!(study -> project (project_id));
739+
diesel::joinable!(timetablev2 -> electrical_profile_set (electrical_profile_set_id));
740+
diesel::joinable!(timetablev2 -> infra (infra_id));
684741
diesel::joinable!(train_schedule -> pathfinding (path_id));
685742
diesel::joinable!(train_schedule -> rolling_stock (rolling_stock_id));
686743
diesel::joinable!(train_schedule -> timetable (timetable_id));
744+
diesel::joinable!(trainschedulev2 -> rolling_stock (rolling_stock_id));
745+
diesel::joinable!(trainschedulev2 -> timetablev2 (timetable_id));
687746

688747
diesel::allow_tables_to_appear_in_same_query!(
689748
document,
@@ -717,6 +776,7 @@ diesel::allow_tables_to_appear_in_same_query!(
717776
rolling_stock_livery,
718777
rolling_stock_separate_image,
719778
scenario,
779+
scenariov2,
720780
search_operational_point,
721781
search_project,
722782
search_scenario,
@@ -726,5 +786,7 @@ diesel::allow_tables_to_appear_in_same_query!(
726786
simulation_output,
727787
study,
728788
timetable,
789+
timetablev2,
729790
train_schedule,
791+
trainschedulev2,
730792
);

0 commit comments

Comments
 (0)