Ruby on rails Rails Capistrano迁移任务中postgres的首次部署错误
我在跑步:Ruby on rails Rails Capistrano迁移任务中postgres的首次部署错误,ruby-on-rails,ruby,postgresql,web-deployment,capistrano3,Ruby On Rails,Ruby,Postgresql,Web Deployment,Capistrano3,我在跑步: cap production deploy 在此步骤之前,一切正常: ** Execute deploy:migrating 01:05 deploy:migrating 01 ~/.rvm/bin/rvm default do bundle exec rake db:migrate 01 == 20160811165131 AddRefColorToProfileModels: migrating ======================= 01 -- add_referen
cap production deploy
在此步骤之前,一切正常:
** Execute deploy:migrating
01:05 deploy:migrating
01 ~/.rvm/bin/rvm default do bundle exec rake db:migrate
01 == 20160811165131 AddRefColorToProfileModels: migrating =======================
01 -- add_reference(:profile_models, :ayes_color, {:foreign_key=>true, :index=>true})
01 rake aborted!
01 StandardError: An error has occurred, this and all later migrations canceled:
01
01 PG::UndefinedTable: ERROR: relation "ayes_colors" does not exist
01 : ALTER TABLE "profile_models" ADD CONSTRAINT "fk_rails_d2695831c0"
01 FOREIGN KEY ("ayes_color_id")
01 REFERENCES "ayes_colors" ("id")
01 /home/deployer/apps/cubamodela/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.0/lib/active_record/connection_adapters/postgresql/data…
01 /home/deployer/apps/cubamodela/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.0/lib/active_record/connection_adapters/postgresql/data…
01 /home/deployer/apps/cubamodela/shared/bundle/ruby/2.3.0/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract_adapte…
...
我不知道这是否重要,但无论如何,在这次失败的迁移中,我犯了一个错误,写了eyes\u color(我写了ayes\u color),后来我写了其他迁移来纠正这个错误
ProfileModel类中的行是:
belongs_to :eyes_color, class_name: "Color", foreign_key: "eyes_color_id", optional: true
在上一次迁移中,我有一个表颜色
class CreateColors < ActiveRecord::Migration[5.0]
def change
create_table :colors do |t|
t.string :name
t.timestamps
end
end
end
class CreateColors
如果需要任何其他信息,请告诉我。
提前谢谢你的帮助
更新
class AddRefColorToProfileModels < ActiveRecord::Migration[5.0]
def change
add_reference :profile_models, :ayes_color, foreign_key: true, index: true
end
end
class AddRefColorToProfileModels
rake db:migrate:status的输出是什么?AddRefColorToProfileModels
migration-to-your post从日志a think is-rake退出状态:1您解决了吗?rake db:migrate:status的输出是什么?AddRefColorToProfileModels
从日志a think is迁移到您的postrake退出状态:1您解决了吗?