Currently, versions
of schema_migrations
are kept in structure.sql
as one big insert statement at the bottom of the structure.sql
. When multiple developers are modifying the db schema on feature branches, you usually end up with a bunch of conflicts around that insert.
At some point in my career, I landed in a Rails project which was undergoing some serious db structure overhaul and touching anything db-related as a pure nightmare - I often resolved conflicts in structure.sql
multiple times a day. As an act of desperation, I stole some code from Gitlab - as they solved this pain a while ago (only for Postgres though, but let’s focus on idea rather than implementation details for each db adapter for now).
I still believe this is a problem worth addressing, but having some 3rd party alternative solution is a losing battle unless I (we?) join you .
What do you think about having such a feature behind another configuration flag? Something aside from config.active_record.schema_format
- maybe config.active_record.schema_version_format
(sql
/ file
?) or similar.
References:
- Conflict-free schema version handling (!30109) · Merge requests · GitLab.org / GitLab · GitLab
- Development change: Database schema version handling outside of structure.sql (#218590) · Issues · GitLab.org / GitLab · GitLab
- Support multiple DBs for loading/dumping of schema_migrations/ (!64884) · Merge requests · GitLab.org / GitLab · GitLab