From c4db0f7091d48154838c8e3bc20e509c0e70156c Mon Sep 17 00:00:00 2001 From: Henrik Hartiala Date: Wed, 23 Aug 2023 13:16:20 +0300 Subject: [PATCH] Remove fk constraints from return_value.timetable_version These return_value schema tables are only for function return values, and they should not be part of the data model via any constraints. --- .../down.sql | 11 +++++++++++ .../up.sql | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 migrations/hsl/timetables/1692783935710_remove_foreign_key_constraints_on_return_value_timetable_version/down.sql create mode 100644 migrations/hsl/timetables/1692783935710_remove_foreign_key_constraints_on_return_value_timetable_version/up.sql diff --git a/migrations/hsl/timetables/1692783935710_remove_foreign_key_constraints_on_return_value_timetable_version/down.sql b/migrations/hsl/timetables/1692783935710_remove_foreign_key_constraints_on_return_value_timetable_version/down.sql new file mode 100644 index 00000000..742260c5 --- /dev/null +++ b/migrations/hsl/timetables/1692783935710_remove_foreign_key_constraints_on_return_value_timetable_version/down.sql @@ -0,0 +1,11 @@ +ALTER TABLE return_value.timetable_version + ADD CONSTRAINT timetable_version_vehicle_schedule_frame_id_fkey + FOREIGN KEY (vehicle_schedule_frame_id) REFERENCES vehicle_schedule.vehicle_schedule_frame(vehicle_schedule_frame_id); + +ALTER TABLE return_value.timetable_version + ADD CONSTRAINT timetable_version_substitute_operating_day_by_line_type_id_fkey + FOREIGN KEY (substitute_operating_day_by_line_type_id) REFERENCES service_calendar.substitute_operating_day_by_line_type(substitute_operating_day_by_line_type_id); + +ALTER TABLE return_value.timetable_version + ADD CONSTRAINT timetable_version_day_type_id_fkey + FOREIGN KEY (day_type_id) REFERENCES service_calendar.day_type(day_type_id); diff --git a/migrations/hsl/timetables/1692783935710_remove_foreign_key_constraints_on_return_value_timetable_version/up.sql b/migrations/hsl/timetables/1692783935710_remove_foreign_key_constraints_on_return_value_timetable_version/up.sql new file mode 100644 index 00000000..db2e7608 --- /dev/null +++ b/migrations/hsl/timetables/1692783935710_remove_foreign_key_constraints_on_return_value_timetable_version/up.sql @@ -0,0 +1,8 @@ +ALTER TABLE return_value.timetable_version + DROP CONSTRAINT timetable_version_day_type_id_fkey; + +ALTER TABLE return_value.timetable_version + DROP CONSTRAINT timetable_version_substitute_operating_day_by_line_type_id_fkey; + +ALTER TABLE return_value.timetable_version + DROP CONSTRAINT timetable_version_vehicle_schedule_frame_id_fkey;