Why Does schema.rb (or structure.sql) Have Unexpected Changes?
April 27, 2023
For years I’ve seen people new to Rails get confused about why their schema.rb
or structure.sql
files have unexpected changes in them, particularly when the engineer is new to working on a Rails project in a team environment. Let’s put this mystery to rest. In this post, I’ll explain reasons why this happens, what to do when it happens, and recommended practices to avoid commiting (or forgetting to commit) the necessary changes to these files.