【发布时间】:2019-09-17 06:46:56
【问题描述】:
我在使用 rails 时遇到了一些数据库问题。当我运行rails db:migrate 时,出现以下错误:
add_column(:locations, :user_id, :integer)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: no such table: locations: ALTER TABLE "locations" ADD "user_id" integer
问题似乎是我有一个迁移尝试将:user_id 添加到表:locations 但该表不存在,因为我删除了它,因此它不在架构中。我该如何解决这个问题?我一直认为删除迁移是个坏主意。
【问题讨论】:
标签: ruby-on-rails ruby postgresql sqlite