Skip to content

Add guideline about resetting schema cache in migration docs

Catalin Irimie requested to merge cat-schema-cache-migration-docs into master

What does this MR do?

If using ActiveRecord, there may be cases where the schema is changed in a previous migration and is cached, resulting in weird behaviors if using the column that was altered but not refreshed.

As per https://github.com/rails/rails/pull/24300#issuecomment-201321397, reset_column_information should be used when using models in migrations.

Based on the findings in #225203 (comment 372100469) and related Slack discussion (internal-only)

Edited by Catalin Irimie

Merge request reports

Loading