Skip to content

Commit aa69e74

Browse files
committed
editoast: add new tables
1 parent 93a8cc3 commit aa69e74

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
@@ -490,6 +490,24 @@ diesel::table! {
490490
}
491491
}
492492

493+
diesel::table! {
494+
use diesel::sql_types::*;
495+
use postgis_diesel::sql_types::*;
496+
497+
scenariov2 (id) {
498+
id -> Int8,
499+
#[max_length = 128]
500+
name -> Varchar,
501+
#[max_length = 1024]
502+
description -> Varchar,
503+
creation_date -> Timestamptz,
504+
last_modification -> Timestamptz,
505+
tags -> Array<Nullable<Text>>,
506+
timetable_id -> Int8,
507+
study_id -> Int8,
508+
}
509+
}
510+
493511
diesel::table! {
494512
use diesel::sql_types::*;
495513
use postgis_diesel::sql_types::*;
@@ -633,6 +651,17 @@ diesel::table! {
633651
}
634652
}
635653

654+
diesel::table! {
655+
use diesel::sql_types::*;
656+
use postgis_diesel::sql_types::*;
657+
658+
timetablev2 (id) {
659+
id -> Int8,
660+
infra_id -> Int8,
661+
electrical_profile_set_id -> Nullable<Int8>,
662+
}
663+
}
664+
636665
diesel::table! {
637666
use diesel::sql_types::*;
638667
use postgis_diesel::sql_types::*;
@@ -661,6 +690,30 @@ diesel::table! {
661690
}
662691
}
663692

693+
diesel::table! {
694+
use diesel::sql_types::*;
695+
use postgis_diesel::sql_types::*;
696+
697+
trainschedulev2 (id) {
698+
id -> Int8,
699+
#[max_length = 128]
700+
train_name -> Varchar,
701+
labels -> Jsonb,
702+
rolling_stock_id -> Int8,
703+
timetable_id -> Int8,
704+
departure_time -> Float8,
705+
scheduled_points -> Jsonb,
706+
allowances -> Jsonb,
707+
initial_speed -> Float8,
708+
#[max_length = 8]
709+
comfort -> Varchar,
710+
#[max_length = 128]
711+
speed_limit_tags -> Nullable<Varchar>,
712+
power_restriction_ranges -> Nullable<Jsonb>,
713+
options -> Nullable<Jsonb>,
714+
}
715+
}
716+
664717
diesel::joinable!(infra_layer_buffer_stop -> infra (infra_id));
665718
diesel::joinable!(infra_layer_detector -> infra (infra_id));
666719
diesel::joinable!(infra_layer_electrification -> infra (infra_id));
@@ -694,16 +747,22 @@ diesel::joinable!(scenario -> electrical_profile_set (electrical_profile_set_id)
694747
diesel::joinable!(scenario -> infra (infra_id));
695748
diesel::joinable!(scenario -> study (study_id));
696749
diesel::joinable!(scenario -> timetable (timetable_id));
750+
diesel::joinable!(scenariov2 -> study (study_id));
751+
diesel::joinable!(scenariov2 -> timetablev2 (timetable_id));
697752
diesel::joinable!(search_operational_point -> infra_object_operational_point (id));
698753
diesel::joinable!(search_project -> project (id));
699754
diesel::joinable!(search_scenario -> scenario (id));
700755
diesel::joinable!(search_signal -> infra_object_signal (id));
701756
diesel::joinable!(search_study -> study (id));
702757
diesel::joinable!(simulation_output -> train_schedule (train_schedule_id));
703758
diesel::joinable!(study -> project (project_id));
759+
diesel::joinable!(timetablev2 -> electrical_profile_set (electrical_profile_set_id));
760+
diesel::joinable!(timetablev2 -> infra (infra_id));
704761
diesel::joinable!(train_schedule -> pathfinding (path_id));
705762
diesel::joinable!(train_schedule -> rolling_stock (rolling_stock_id));
706763
diesel::joinable!(train_schedule -> timetable (timetable_id));
764+
diesel::joinable!(trainschedulev2 -> rolling_stock (rolling_stock_id));
765+
diesel::joinable!(trainschedulev2 -> timetablev2 (timetable_id));
707766

708767
diesel::allow_tables_to_appear_in_same_query!(
709768
document,
@@ -738,6 +797,7 @@ diesel::allow_tables_to_appear_in_same_query!(
738797
rolling_stock_livery,
739798
rolling_stock_separate_image,
740799
scenario,
800+
scenariov2,
741801
search_operational_point,
742802
search_project,
743803
search_scenario,
@@ -747,5 +807,7 @@ diesel::allow_tables_to_appear_in_same_query!(
747807
simulation_output,
748808
study,
749809
timetable,
810+
timetablev2,
750811
train_schedule,
812+
trainschedulev2,
751813
);

0 commit comments

Comments
 (0)