문제

Does anybody know why whenever I run rake db:migrate in my production environment, the schema.rb file is changed?

The differences are only on the created_at, update_at columns of all model tables:

-    t.datetime "created_at"
-    t.datetime "updated_at"
+    t.datetime "created_at",            null: false
+    t.datetime "updated_at",            null: false

I know that this is what it finds in the production db, but why were they created as null: false there and not in the development db too?

도움이 되었습니까?

해결책

I had the same thing on my dev machine. Running db:drop in production is not a wise idea, but what will fix the 'problem':

rake db:drop db:create db:migrate

My mysql version had changed since I first created the database with rails. The migrations still ran according to the old mysql version.

This is what probabaly happens at your production environment.

다른 팁

Check your mysql version in production system and system where you used in development mode. There was a similar issue with default values.

Check this link : https://www.ruby-forum.com/topic/134121

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top