From a3c289f03e53a8d8a74f38c192f00c28b9b11419 Mon Sep 17 00:00:00 2001 From: Jarno Perholehto Date: Wed, 16 Aug 2023 12:20:04 +0300 Subject: [PATCH] Move unique constraint to repeatable migration --- .../1683624912748_create_substitute_operating_period/up.sql | 2 +- .../down.sql | 1 + .../up.sql | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 migrations/hsl/timetables/2000000000105_R_after_migrate_create_substitute_operating_period/down.sql create mode 100644 migrations/hsl/timetables/2000000000105_R_after_migrate_create_substitute_operating_period/up.sql diff --git a/migrations/hsl/timetables/1683624912748_create_substitute_operating_period/up.sql b/migrations/hsl/timetables/1683624912748_create_substitute_operating_period/up.sql index de62d54f..ad0496fd 100644 --- a/migrations/hsl/timetables/1683624912748_create_substitute_operating_period/up.sql +++ b/migrations/hsl/timetables/1683624912748_create_substitute_operating_period/up.sql @@ -1,6 +1,6 @@ CREATE TABLE service_calendar.substitute_operating_period ( substitute_operating_period_id uuid DEFAULT gen_random_uuid(), - period_name text UNIQUE NOT NULL, + period_name text NOT NULL, is_preset boolean NOT NULL DEFAULT FALSE ); diff --git a/migrations/hsl/timetables/2000000000105_R_after_migrate_create_substitute_operating_period/down.sql b/migrations/hsl/timetables/2000000000105_R_after_migrate_create_substitute_operating_period/down.sql new file mode 100644 index 00000000..ea42041e --- /dev/null +++ b/migrations/hsl/timetables/2000000000105_R_after_migrate_create_substitute_operating_period/down.sql @@ -0,0 +1 @@ +ALTER TABLE service_calendar.substitute_operating_period DROP CONSTRAINT substitute_operating_period_period_name_key; diff --git a/migrations/hsl/timetables/2000000000105_R_after_migrate_create_substitute_operating_period/up.sql b/migrations/hsl/timetables/2000000000105_R_after_migrate_create_substitute_operating_period/up.sql new file mode 100644 index 00000000..18f798c6 --- /dev/null +++ b/migrations/hsl/timetables/2000000000105_R_after_migrate_create_substitute_operating_period/up.sql @@ -0,0 +1,2 @@ +ALTER TABLE service_calendar.substitute_operating_period + ADD CONSTRAINT substitute_operating_period_period_name_key UNIQUE (period_name);