diff --git a/db/post_migrate/20230928104015_sync_foreign_key_for_ci_stages_pipeline_id_bigint.rb b/db/post_migrate/20230928104015_sync_foreign_key_for_ci_stages_pipeline_id_bigint.rb new file mode 100644 index 0000000000000000000000000000000000000000..139f8a9ea4c16d031b3a75d9d23baad9224c3b33 --- /dev/null +++ b/db/post_migrate/20230928104015_sync_foreign_key_for_ci_stages_pipeline_id_bigint.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class SyncForeignKeyForCiStagesPipelineIdBigint < Gitlab::Database::Migration[2.1] + TABLE_NAME = :ci_stages + COLUMN_NAME = :pipeline_id_convert_to_bigint + FK_NAME = :fk_c5ddde695f + + def up + validate_foreign_key TABLE_NAME, COLUMN_NAME, name: FK_NAME + end + + def down + # Can be safely a no-op if we don't roll back the inconsistent data. + end +end diff --git a/db/schema_migrations/20230928104015 b/db/schema_migrations/20230928104015 new file mode 100644 index 0000000000000000000000000000000000000000..0a5c76846bf91748921be7a912324eac5ae82040 --- /dev/null +++ b/db/schema_migrations/20230928104015 @@ -0,0 +1 @@ +f71caebfefb4b4fabbb3f9cc059f6f105ea352da11380901b16c687dcca1e6d4 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 6b022276fea3a494f83263b49a58144b5d38bd81..bc037192d781e67797efb26667ab6f15a09c19bc 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -37484,7 +37484,7 @@ ALTER TABLE ONLY geo_event_log ADD CONSTRAINT fk_c4b1c1f66e FOREIGN KEY (repository_deleted_event_id) REFERENCES geo_repository_deleted_events(id) ON DELETE CASCADE; ALTER TABLE ONLY ci_stages - ADD CONSTRAINT fk_c5ddde695f FOREIGN KEY (pipeline_id_convert_to_bigint) REFERENCES ci_pipelines(id) ON DELETE CASCADE NOT VALID; + ADD CONSTRAINT fk_c5ddde695f FOREIGN KEY (pipeline_id_convert_to_bigint) REFERENCES ci_pipelines(id) ON DELETE CASCADE; ALTER TABLE ONLY issues ADD CONSTRAINT fk_c63cbf6c25 FOREIGN KEY (closed_by_id) REFERENCES users(id) ON DELETE SET NULL;