Skip to content

Reset database state after migration test

Marius Bobin requested to merge mb-fix-master-broken into master

What does this MR do and why?

The test was leaving the database in an inconsistent state:

Foreign-key constraints:
    "fk_190998ef09" FOREIGN KEY (external_pull_request_id) REFERENCES external_pull_requests(id) ON DELETE SET NULL
    "fk_3d34ab2e06" FOREIGN KEY (pipeline_schedule_id) REFERENCES ci_pipeline_schedules(id) ON DELETE SET NULL
    "fk_4_auto_canceled_by_id" FOREIGN KEY (auto_canceled_by_id) REFERENCES ci_pipelines(id) ON DELETE SET NULL
    "fk_d80e161c54" FOREIGN KEY (ci_ref_id) REFERENCES ci_refs(id) ON DELETE SET NULL
Referenced by:
    TABLE "ci_pipelines" CONSTRAINT "fk_4_auto_canceled_by_id" FOREIGN KEY (auto_canceled_by_id) REFERENCES ci_pipelines(id) ON DELETE SET NULL

Reproduce with: bin/rspec spec/migrations/20231025025733_swap_columns_for_ci_pipelines_pipeline_id_bigint_for_self_host_spec.rb:21 spec/migrations/20231019003052_swap_columns_for_ci_pipelines_pipeline_id_bigint_v2_spec.rb:15

Related to gitlab-org/quality/engineering-productivity/master-broken-incidents#4526 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Marius Bobin

Merge request reports