Skip to content
Snippets Groups Projects

Make migrations skipped in production a no-op

Merged Simon Tomlinson requested to merge noop-migrations-incident-14888 into master
2 unresolved threads

What does this MR do and why?

Make migrations skipped in production on the ci database as a no-op

Migrations

  • db/post_migrate/20230524135750_replace_ci_job_artifacts_foreign_key.rb
  • db/post_migrate/20230524135803_replace_ci_running_builds_foreign_key.rb
  • db/post_migrate/20230524135815_replace_ci_job_variables_foreign_key.rb
  • db/post_migrate/20230524135828_replace_p_ci_builds_metadata_foreign_key.rb
  • db/post_migrate/20230524135840_replace_p_ci_runner_machine_builds_foreign_key.rb

were skipped in production on the ci database as part of gitlab-com/gl-infra/production#14888 (closed).

Mark them as no-op so that they do not execute in other environments.

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.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Mayra Cabrera resolved all threads

    resolved all threads

  • merged

    • @mayra-cabrera, did you forget to run a pipeline before you merged this work? Based on our code review process, if the latest pipeline was created more than 6 hours ago OR finished more than 2 hours ago, you should:

      1. Ensure the merge request is not in Draft status.
      2. Start a pipeline (especially important for Community contribution merge requests).
      3. Set the merge request to auto-merge.

      This is a guideline, not a rule. Please consider replying to this comment for transparency.

      This message was generated automatically. You're welcome to improve it.

    • I'm aware of this dear bot. I intentionally didn't run a pipeline to save some CI resources, because this MR is making database migrations non-operational and doesn't require a full suite to run for this, this just the db:* jobs that were successfully executed in the last run (these jobs are not updated often)

    • Please register or sign in to reply
  • Hello @stomlinson :wave:

    The database team is looking for ways to improve the database review process and we would love your help!

    If you'd be open to someone on the database team reaching out to you for a chat, or if you'd like to leave some feedback asynchronously, just post a reply to this comment mentioning:

    @gitlab-org/database-team

    And someone will be by shortly!

    Thanks for your help! :heart:

    This message was generated automatically. You're welcome to improve it.

  • Mayra Cabrera mentioned in commit f0481b9e

    mentioned in commit f0481b9e

    • @stomlinson This results in the following diff for structure.sql

      diff --git a/db/structure.sql b/db/structure.sql
      index 49f272810366..4727e1040d3a 100644
      --- a/db/structure.sql
      +++ b/db/structure.sql
      @@ -37975,6 +37978,9 @@ ALTER TABLE ONLY ci_sources_pipelines
       ALTER TABLE ONLY ci_resources
           ADD CONSTRAINT temp_fk_e169a8e3d5_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE SET NULL;
       
      +ALTER TABLE ONLY ci_builds_metadata
      +    ADD CONSTRAINT temp_fk_e20479742e_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
      +
       ALTER TABLE ONLY ci_build_report_results
           ADD CONSTRAINT temp_fk_rails_16cb1ff064_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
       
      @@ -37990,6 +37996,15 @@ ALTER TABLE ONLY ci_pending_builds
       ALTER TABLE ONLY ci_build_trace_metadata
           ADD CONSTRAINT temp_fk_rails_aebc78111f_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
       
      +ALTER TABLE ONLY ci_job_artifacts
      +    ADD CONSTRAINT temp_fk_rails_c5137cb2c1_p FOREIGN KEY (partition_id, job_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
      +
      +ALTER TABLE ONLY ci_running_builds
      +    ADD CONSTRAINT temp_fk_rails_da45cfa165_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
      +
      +ALTER TABLE ONLY ci_job_variables
      +    ADD CONSTRAINT temp_fk_rails_fbf3b34792_p FOREIGN KEY (partition_id, job_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
      +
       ALTER TABLE ONLY user_follow_users
           ADD CONSTRAINT user_follow_users_followee_id_fkey FOREIGN KEY (followee_id) REFERENCES users(id) ON DELETE CASCADE;

      Should we clean up local databases manually?

    • @krasio I'm re-adding them in !123355 (merged) and I hope that they will be merged today/tomorrow.

    • Please register or sign in to reply
  • added workflowstaging label and removed workflowcanary label

  • Marius Bobin mentioned in merge request !123355 (merged)

    mentioned in merge request !123355 (merged)

  • mentioned in merge request mbobin/headway!1 (closed)

  • Please register or sign in to reply
    Loading