PG :: UndefinedTable:Heroku上的错误

时间:2015-10-19 16:26:17

标签: ruby-on-rails postgresql activerecord heroku

首先,在本地计算机应用程序正在运行。

但是当我输入heroku run rake db:migrate时,我在控制台中收到错误。像这样:

  

PG :: UndefinedTable:ERROR:relation" subject_items"不存在   :ALTER TABLE" subject_items"添加" student_id"整数/ app / vendor / bundle / ruby​​ / 2.2.0 / gems / activerecord-4.2.1 / lib / active_record / connection_adapters / postgresql / database_statements.rb:155:in`async_exec'

     

ActiveRecord :: StatementInvalid:PG :: UndefinedTable:ERROR:relation" subject_items"不存在   :ALTER TABLE" subject_items"添加" student_id"整数   /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.1/lib/act

     

/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.1/lib/active_record/migration.rb:652:in`method_missing&& 39;   /app/db/migrate/20151018091819_add_student_id_to_subject_items.rb:3:in change'

正如我所说,本地工作。

日志中提到的迁移文件如下所示:

class AddStudentIdToSubjectItems < ActiveRecord::Migration
  def change
    add_column :subject_items, :student_id, :integer
  end
end

有些schema.db

create_table "subject_items", force: :cascade do |t|
t.string   "title"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer  "teacher_id"
t.integer  "student_id"
end

哪里可能有问题?

0 个答案:

没有答案