jeudi 17 janvier 2019

How to fix Rails Schema file being auto edit after rake db:migrate

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.

Aucun commentaire:

Enregistrer un commentaire