Prevent database schema conflicts for developers

To avoid schema conflicts in development environment usually developers have
to dump a new fresh schema. To avoid that i suggest we use some kind of gem like https://github.com/jakeonrails/fix-db-schema-conflicts to sort columns.

How it works

This gem sorts the table, index, extension, and foreign key names before outputting them to the schema.rb file. Additionally it runs Rubocop with the auto-correct flag to ensure a consistent output format.

Downside

I still did not test this gem but i think the downside is that we won't be able to enforce our own column order, for example having timestamps in the last positions of the table.

A way to mitigate this is enforce our own ordering based on column types following: https://docs.gitlab.com/ee/development/ordering_table_columns.html

Edited Jul 03, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading