Commit 4ccca52f authored by Patrick Derichs's avatar Patrick Derichs

Rename CONSTRAINT on resource_state_events

parent 509df13f
# frozen_string_literal: true
class ChangeConstraintNameOnResourceStateEvents < ActiveRecord::Migration[6.0]
DOWNTIME = false
NEW_CONSTRAINT_NAME = 'state_events_must_belong_to_issue_or_merge_request_or_epic'
OLD_CONSTRAINT_NAME = 'resource_state_events_must_belong_to_issue_or_merge_request_or_epic'
def up
execute "ALTER TABLE resource_state_events RENAME CONSTRAINT #{OLD_CONSTRAINT_NAME} TO #{NEW_CONSTRAINT_NAME};"
end
def down
execute "ALTER TABLE resource_state_events RENAME CONSTRAINT #{NEW_CONSTRAINT_NAME} TO #{OLD_CONSTRAINT_NAME};"
end
end
...@@ -5895,7 +5895,7 @@ CREATE TABLE public.resource_state_events ( ...@@ -5895,7 +5895,7 @@ CREATE TABLE public.resource_state_events (
created_at timestamp with time zone NOT NULL, created_at timestamp with time zone NOT NULL,
state smallint NOT NULL, state smallint NOT NULL,
epic_id integer, epic_id integer,
CONSTRAINT resource_state_events_must_belong_to_issue_or_merge_request_or_ CHECK ((((issue_id <> NULL::bigint) AND (merge_request_id IS NULL) AND (epic_id IS NULL)) OR ((issue_id IS NULL) AND (merge_request_id <> NULL::bigint) AND (epic_id IS NULL)) OR ((issue_id IS NULL) AND (merge_request_id IS NULL) AND (epic_id <> NULL::integer)))) CONSTRAINT state_events_must_belong_to_issue_or_merge_request_or_epic CHECK ((((issue_id <> NULL::bigint) AND (merge_request_id IS NULL) AND (epic_id IS NULL)) OR ((issue_id IS NULL) AND (merge_request_id <> NULL::bigint) AND (epic_id IS NULL)) OR ((issue_id IS NULL) AND (merge_request_id IS NULL) AND (epic_id <> NULL::integer))))
); );
CREATE SEQUENCE public.resource_state_events_id_seq CREATE SEQUENCE public.resource_state_events_id_seq
...@@ -13776,5 +13776,6 @@ COPY "schema_migrations" (version) FROM STDIN; ...@@ -13776,5 +13776,6 @@ COPY "schema_migrations" (version) FROM STDIN;
20200527152116 20200527152116
20200527152657 20200527152657
20200528123703 20200528123703
20200603073101
\. \.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment