0

We have always had some issues with rails schema file. It got worse after upgraded from rails 3 to rails 4.2. So everytime someone runs "db: migrate" on the local machine, it adds, removes or edit stuff in the schema file. Nothing got affected in the database though.

When we were on Rails3, we got changes like string limit: 255 changes to 100, columns removed and added back in a different row. In Rails 4, apart from the pre-existing ones, we got all the timestamp (created_at, updated_at) added with null: false. We don't set up the default for timestamp in migration files. Also, the index names are changed to those rails generated ones, but we do specify the index names and they are sitting in the database without any issue.

Now it gets really annoying as it causes conflicts on and making noise. Any suggestion to fix this?

User Rails 4.2.10, Ruby 2.5.3, mysql version 5.7.22 by Homebrew.

B Liu
  • 113
  • 1
  • 5
  • Is this happening on each run of db:migration event if no migrations updated? there is gem which fixes the conflicts in db schema file checkout if it helps https://github.com/jakeonrails/fix-db-schema-conflicts – Pramod Shinde Jan 18 '19 at 07:22
  • Thanks for the advice@PramodShinde. And yes it happens even if we have nothing to migrate. I did have a quick check with that gem before, it didn't work. But that gem might only help to fix part of my issues which is to protect the reordering of fields. Maybe I should look deeper into it again. – B Liu Jan 19 '19 at 20:47

0 Answers0