Cannot run rake db:migrate, relation does not exist

前端 未结 2 515
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-14 09:53

I am trying to get a working app to work on linux 10.04 running on vagrant

I installed all relevant gems, installed postgresql 9.1.9 and when I am trying to run

相关标签:
2条回答
  • 2021-01-14 10:39

    Just trying to check on the obvious here, but have you tried running rake db:drop? Whenever I make changes to my migrations, I need to drop all of my DB tables before I try to create and migrate them.

    So the full operation would be rake db:drop db:create db:migrate

    Oh, and you can also try to specify the environment (I sometimes need to do that on test environments), e.g. rake RAILS_ENV=test db:drop db:create db:migrate

    0 讨论(0)
  • 2021-01-14 10:42

    The Routes file in Rails uses device_for, which loads the User model, which in turn has acts_as_messagable and loads the Message class. Line #29 in Message class says:

    scope :unread, where('reciever_open = false')

    The where method is triggering a column lookup, which fails because the migrations haven't run yet! Try one of these two:

    Change this to:

    scope :unread, where(:reciever_open => false)

    Or if that also triggers a column lookup, then say:

    scope :unread, lambda { where('reciever_open = false') }

    0 讨论(0)
提交回复
热议问题