From df45edf5de96018e9c58bc653302a5adbaaeb6cb Mon Sep 17 00:00:00 2001 From: Henrik Hartiala Date: Wed, 6 Sep 2023 10:20:00 +0300 Subject: [PATCH] Remove unused function get_vehicle_services_for_date Earlier we created a more precise function get_vehicle_schedules_on_date, and replaced the use in front end with that. It is no more used and after a minor review it seems there is no use for this function any more, so removing it completely as dead code. Resolves HSLdevcom/jore4#1437 --- .../databases/timetables/functions/functions.yaml | 1 - ...hicle_service_get_vehicle_services_for_date.yaml | 3 --- .../down.sql | 2 -- .../up.sql | 13 ------------- 4 files changed, 19 deletions(-) delete mode 100644 metadata/hsl/databases/timetables/functions/vehicle_service_get_vehicle_services_for_date.yaml delete mode 100644 migrations/hsl/timetables/2000000000101_R_after_migrate_create_vehicle_service/down.sql delete mode 100644 migrations/hsl/timetables/2000000000101_R_after_migrate_create_vehicle_service/up.sql diff --git a/metadata/hsl/databases/timetables/functions/functions.yaml b/metadata/hsl/databases/timetables/functions/functions.yaml index 474d1792..1fffcfe8 100644 --- a/metadata/hsl/databases/timetables/functions/functions.yaml +++ b/metadata/hsl/databases/timetables/functions/functions.yaml @@ -1,5 +1,4 @@ - "!include service_calendar_get_active_day_types_for_date.yaml" - "!include vehicle_service_get_timetable_versions_by_journey_pattern_ids.yaml" - "!include vehicle_service_get_timetables_and_substitute_operating_days.yaml" -- "!include vehicle_service_get_vehicle_services_for_date.yaml" - "!include vehicle_journey_get_vehicle_schedules_on_date.yaml" diff --git a/metadata/hsl/databases/timetables/functions/vehicle_service_get_vehicle_services_for_date.yaml b/metadata/hsl/databases/timetables/functions/vehicle_service_get_vehicle_services_for_date.yaml deleted file mode 100644 index 0adc4663..00000000 --- a/metadata/hsl/databases/timetables/functions/vehicle_service_get_vehicle_services_for_date.yaml +++ /dev/null @@ -1,3 +0,0 @@ -function: - name: get_vehicle_services_for_date - schema: vehicle_service diff --git a/migrations/hsl/timetables/2000000000101_R_after_migrate_create_vehicle_service/down.sql b/migrations/hsl/timetables/2000000000101_R_after_migrate_create_vehicle_service/down.sql deleted file mode 100644 index 29f28255..00000000 --- a/migrations/hsl/timetables/2000000000101_R_after_migrate_create_vehicle_service/down.sql +++ /dev/null @@ -1,2 +0,0 @@ --- we don't drop functions and constraints here, they are dropped in the before_migrate hook -SELECT 1; diff --git a/migrations/hsl/timetables/2000000000101_R_after_migrate_create_vehicle_service/up.sql b/migrations/hsl/timetables/2000000000101_R_after_migrate_create_vehicle_service/up.sql deleted file mode 100644 index 79238702..00000000 --- a/migrations/hsl/timetables/2000000000101_R_after_migrate_create_vehicle_service/up.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE OR REPLACE FUNCTION vehicle_service.get_vehicle_services_for_date(observation_date date) - RETURNS SETOF vehicle_service.vehicle_service - LANGUAGE sql STABLE -AS $$ - SELECT vs.* - FROM vehicle_service.vehicle_service vs - JOIN service_calendar.get_active_day_types_for_date(observation_date) dt on vs.day_type_id = dt.day_type_id - JOIN vehicle_schedule.vehicle_schedule_frame vsf on vs.vehicle_schedule_frame_id = vsf.vehicle_schedule_frame_id - -- match only effective vehicle schedule frames on the given operating day - WHERE observation_date BETWEEN vsf.validity_start AND vsf.validity_end -$$; -COMMENT ON FUNCTION vehicle_service.get_vehicle_services_for_date IS 'Find all vehicle services that are active on the given observation date. -The results are not filtered by highest priority, that can be done on the UI on demand';