Heroku - PGError:错误:"ENGINE"处或附近的语法错误

Mat*_*iby 0 ruby migration ruby-on-rails heroku

我想跑

heroku rake db:migrate
Run Code Online (Sandbox Code Playgroud)

在heroku上运行我的迁移,前两次迁移运行得很好,但第三次迁移看起来像这样

create_table :charities, :options => "ENGINE=MyISAM" do |t|
  t.string :name,               :null => false
  t.string :title,              :null => false
  t.timestamps
end

add_index :charities, :name
add_index :charities, :title


Migrating to CreateCharitiesAndThemes (20091019140537)
==  CreateCharitiesAndThemes: migrating =======================================
-- create_table(:charities, {:options=>"ENGINE=MyISAM"})
rake aborted!
An error has occurred, this and all later migrations canceled:

PGError: ERROR:  syntax error at or near "ENGINE"
LINE 1: ..., "created_at" timestamp, "updated_at" timestamp) ENGINE=MyI...
                                                             ^
: CREATE TABLE "charities" ("id" serial primary key, "name" character varying(255) NOT NULL, "title" character varying(255) NOT NULL, "created_at" timestamp, "updated_at" timestamp) ENGINE=MyISAM
Run Code Online (Sandbox Code Playgroud)

mik*_*ong 9

Heroku使用PostgreSQL,MyISAM引擎是特定于MySQL的.我建议你删除那部分.或者,添加检查使用的数据库并使其成为可选项.

这是一个如何检查数据库的链接.

  • 或者更好的是,在您部署到的同一堆栈之上进行开发. (4认同)