-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- New table service_calendar.substitute_operating_period to group substitute_operating_days - New view service_calendar.substitute_operating_period_with_date_range to get periods with date range and linetypes - New function service_calendar.save_operating_periods handles saving/updating substitute_operating_days for substitute_operating_periods
- Loading branch information
1 parent
f0391a9
commit 85d4a35
Showing
12 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
metadata/hsl/databases/timetables/tables/substitute_operating_period.yaml
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,11 @@ | ||
table: | ||
name: substitute_operating_period | ||
schema: service_calendar | ||
array_relationships: | ||
- name: substitute_operating_day_by_line_types | ||
using: | ||
foreign_key_constraint_on: | ||
column: substitute_operating_period_id | ||
table: | ||
name: substitute_operating_day_by_line_type | ||
schema: service_calendar |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
- "!include substitute_operating_day_by_line_type.yaml" | ||
- "!include return_value_timetable_version.yaml" | ||
- "!include return_value_vehicle_schedule.yaml" | ||
- "!include substitute_operating_period.yaml" |
4 changes: 4 additions & 0 deletions
4
migrations/hsl/timetables/1683624912748_create_substitute_operating_period/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,4 @@ | ||
ALTER TABLE | ||
ONLY service_calendar.substitute_operating_day_by_line_type DROP COLUMN substitute_operating_period_id; | ||
|
||
DROP TABLE service_calendar.substitute_operating_period; |
22 changes: 22 additions & 0 deletions
22
migrations/hsl/timetables/1683624912748_create_substitute_operating_period/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,22 @@ | ||
CREATE TABLE service_calendar.substitute_operating_period ( | ||
substitute_operating_period_id uuid DEFAULT gen_random_uuid(), | ||
period_name text UNIQUE NOT NULL, | ||
is_preset boolean NOT NULL DEFAULT FALSE | ||
); | ||
|
||
ALTER TABLE ONLY service_calendar.substitute_operating_period | ||
ADD CONSTRAINT substitute_operating_period_pkey PRIMARY KEY (substitute_operating_period_id); | ||
|
||
COMMENT ON COLUMN service_calendar.substitute_operating_period.period_name IS 'Substitute operating period''s name'; | ||
COMMENT ON COLUMN service_calendar.substitute_operating_period.is_preset IS 'Flag indicating whether operating period is preset or not. Preset operating periods have restrictions on the UI'; | ||
|
||
ALTER TABLE ONLY service_calendar.substitute_operating_day_by_line_type | ||
ADD COLUMN substitute_operating_period_id uuid NOT NULL; | ||
|
||
ALTER TABLE ONLY service_calendar.substitute_operating_day_by_line_type | ||
ADD CONSTRAINT substitute_operating_day_by_line_type_substitute_operating_period_fkey FOREIGN KEY (substitute_operating_period_id) REFERENCES service_calendar.substitute_operating_period(substitute_operating_period_id) ON DELETE CASCADE; | ||
|
||
CREATE INDEX substitute_operating_day_by_line_type_substitute_operating_period | ||
ON service_calendar.substitute_operating_day_by_line_type USING btree (substitute_operating_period_id); | ||
|
||
COMMENT ON COLUMN service_calendar.substitute_operating_day_by_line_type.substitute_operating_period_id IS 'The id of the substitute operating period'; |
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
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
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
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
11 changes: 11 additions & 0 deletions
11
test/hasura/hsl/timetablesdb/datasets/defaultSetup/substitute_operating_period.ts
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,11 @@ | ||
import { SubstituteOperatingPeriod } from '../types'; | ||
|
||
export const substituteOperatingPeriodByNames = { | ||
aprilFools: { | ||
substitute_operating_period_id: '0967a31a-8304-4440-9a8e-18bb67b28166', | ||
is_preset: false, | ||
period_name: 'Default korvausjakso', | ||
}, | ||
}; | ||
export const substituteOperatingPeriod: SubstituteOperatingPeriod[] = | ||
Object.values(substituteOperatingPeriodByNames); |
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
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
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