Update INTEGER PK to BIGINT conversion docs
Problem to solve
Code examples in Migrating integer primary keys to bigint are not clear.
Developers are getting confused about the correct use of disable_ddl_transaction!
and enable_lock_retries!
when migrating integer primary keys to bigint.
Further details
Examples shows only the use of enable_lock_retries!
for migrating Integer
PK to Bigint
, but they doesn't mention anything about disable_ddl_transaction!
.
When using initialize_conversion_of_integer_to_bigint
to migrate Integer
primary keys to Bigint
we need to make use of the disable_ddl_transaction!
method to prevent getting this error:
StandardError: An error has occurred, this and all later migrations canceled:
with_lock_retries can not be run inside an already open transaction
Heavy operations in a single transaction guide also suggests the use of disable_ddl_transaction
for heavy db operations.
Proposal
- Updates the docs identifying situations were developers should use
disable_ddl_transaction!
instead ofenable_lock_retries!
Who can address the issue
It will require some knowledge with database review guidelines + migration knowledge