Migration helper `change_column_type_concurrently` is broken
With the introduction of the v2 migration helpers, rename_column_concurrently
no longer accepts the type_cast_function
parameter.
Deliverable
-
Add support for type_cast_function
torename_column_concurrently
Additional notes
First noticed in my MR !104301 (comment 1175186486) but it doesn't work. Because rename_column_concurrently
doesn't accept type_cast_function
parameter.
Related documentation: https://docs.gitlab.com/ee/development/database/avoiding_downtime_in_migrations.html#changing-column-types
Error:
Caused by:
ArgumentError: unknown keyword: :type_cast_function
/Users/valery/gitlab-development-kit/gitlab/lib/gitlab/database/migration_helpers/v2.rb:136:in `rename_column_concurrently'
/Users/valery/gitlab-development-kit/gitlab/lib/gitlab/database/migration_helpers.rb:589:in `change_column_type_concurrently'
/Users/valery/gitlab-development-kit/gitlab/ee/db/geo/post_migrate/20221115145763_change_state_to_integer_in_container_repository_registry.rb:9:in `up'
/Users/valery/gitlab-development-kit/gitlab/lib/gitlab/database/migration_helpers/restrict_gitlab_schema.rb:33:in `block in exec_migration'
/Users/valery/gitlab-development-kit/gitlab/lib/gitlab/database/query_analyzer.rb:37:in `within'
/Users/valery/gitlab-development-kit/gitlab/lib/gitlab/database/migration_helpers/restrict_gitlab_schema.rb:30:in `exec_migration'
/Users/valery/gitlab-development-kit/gitlab/lib/gitlab/database/migrations/lock_retry_mixin.rb:36:in `ddl_transaction'
/Users/valery/.asdf/installs/ruby/2.7.5/bin/bundle:25:in `load'
/Users/valery/.asdf/installs/ruby/2.7.5/bin/bundle:25:in `<main>'
Tasks: TOP => db:migrate
Edited by Alex Ives