Skip to content

Add a helper to rename a column using a background migration

Sean McGivern requested to merge add-rename-column-background-helper into master

What does this MR do?

Adds a helper like we have for changing a column type in a background migration, but for renaming columns.

This reuses a lot of code from the existing background migration, as both need to copy a column, then do some kind of cleanup step.

Are there points in the code the reviewer needs to double check?

The new helper takes a table as a first argument, not a model including EachBatch. This is to match the concurrent rename helper, but it means it doesn't match the background type change helper. Which should we match?

Why was this MR needed?

Issues like gitlab-com/database#95 (closed) and https://gitlab.com/gitlab-org/gitlab-ce/issues/47566 come up when we try to do this type of schema change in a single migration.

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/47591.

Edited by Yorick Peterse

Merge request reports