Skip to content

Reduce conflicts in database schema

With structure.sql, just adding a normal migration results in this diff:

INSERT INTO "schema_migrations" (version) VALUES
('20171230123729'),
('20180101160629'),
('20180101160630'),
...
-('20200319203901');
+('20200319203901'),
+('20200321184203');

This is likely to cause conflicts with other changes on master (just like with schema.rb).

I wonder if we can reduce the potential for conflict with using \copy instead of INSERT. The reason is that \copy accepts CSV which doesn't need line endings. In this case, a new migration would only add a new line but not edit existing ones.