Add a helper to rename a column using a background migration
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?
-
Documentation created/updated -
Tests added for this feature/bug - Conform by the code review guidelines
-
Has been reviewed by a Backend maintainer -
Has been reviewed by a Database specialist
-
What are the relevant issue numbers?
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/47591.
Edited by Yorick Peterse