data-migrate icon indicating copy to clipboard operation
data-migrate copied to clipboard

Optionally disable `data_schema.rb`

Open tmtrademarked opened this issue 3 years ago • 3 comments

In our project, we want to continue to dump the main db schema to our structure file (we happen to use structure.sql for it), but we don't particularly care to use the data_schema.rb file. With our current workflows, this file doesn't seem to provide a lot of value, and generates constant merge conflicts with our team which are a bit of a pain to resolve.

So two questions:

  1. Am I missing something fundamental about the value of this file? Maybe there's something I'm not seeing that means our workflows could or should change?
  2. Assuming we wanted to, would it be reasonable to add support for a configuration to optionally disable the creation of data_schema.rb? It seems like it would help teams with large numbers of contributors, but I'm not sure if such an option is philosophically aligned with this gem.

tmtrademarked avatar Apr 05 '21 15:04 tmtrademarked

Hey @ilyakatz

This has come up a few times since I started using this gem. Would love to know your input as I haven't had time to really look into it and merge conflicts are quite annoying as we seem to do a lot of data migrations 😅

adamzapasnik avatar Mar 23 '23 09:03 adamzapasnik

Hey folks, it's been a long time since I've used this gem (i haven't been in rails land for a long time). I've tried to rejig my memory but really don't remember what the file is for (guess, should have documented it better). Could you provide an example of a file that it generates(if you're able to share without compromising your sensitive data), maybe that will trigger something.

ilyakatz avatar Apr 20 '23 22:04 ilyakatz

sorry for a late response, it's a file generated by running data migrations, it'll just have a single line

DataMigrate::Data.define(version: 2023someversion)

regular migrations would generate schema.rb

it's a source of merge conflicts if there are data migrations on different branches. Same story as with regular migrations.

what has worked for me is simply adding the file to .gitignore as it's not used for anything in my setup (I don't run data migrations in test env, not sure if it'd make any difference if I did, though)

adamzapasnik avatar Aug 15 '23 12:08 adamzapasnik