我的应用程序出现问题。
我正在尝试运行:
heroku run rake db:migrate
但是我收到了这个错误:
Running rake db:migrate on pierwsza1... up, run.7908
ActiveRecord::SchemaMigration Load (22.9ms) SELECT "schema_migrations".* FROM "schema_migrations"
Migrating to AddUserIdToPins (20160515200705)
(1.9ms) BEGIN
== 20160515200705 AddUserIdToPins: migrating ==================================
-- add_column(:pins, :user_id, :integrer)
(3.6ms) ALTER TABLE "pins" ADD "user_id" integrer
(8.6ms) ROLLBACK
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedObject: ERROR: type "integrer" does not exist
LINE 1: ALTER TABLE "pins" ADD "user_id" integrer
这些是我使用rails generate migration add_user_id_to_pins user_id:integer:index:
class AddUserIdToPins < ActiveRecord::Migration
def change
add_column :pins, :user_id, :integer
add_index :pins, :user_id
end
end
答案 0 :(得分:0)
在您的迁移文件中,您已将user_id
定义为整合 r 而不是integer
您只需要使用有效类型
更新迁移文件答案 1 :(得分:0)
检查日志的这一行:
PG::UndefinedObject: ERROR: type "integrer" does not exist
LINE 1: ALTER TABLE "pins" ADD "user_id" integrer
它明确指出您错误输入&#34;整数&#34;使用&#34; integrer&#34;。请在您的文件中更正。