Rails迁移语法错误

时间:2018-01-28 22:45:30

标签: ruby-on-rails ruby

我在尝试.getsmaller

时看到此错误
rake db:migrate

据我所见,我在迁移文件中看不到任何新行:

/db/migrate/20180124161533_a_dd_uid_to_appuser_and_response.rb:22: syntax error, unexpected '\n', expecting =>

知道问题是什么吗?

1 个答案:

答案 0 :(得分:1)

以下是修改代码的示例。只需在所有行的,语句之前删除if。例如,行:

add_column :appusers, :archived, :boolean, algorithm: :concurrently, if !column_exists?(:appusers, :archived)

应该是:

add_column :appusers, :archived, :boolean, algorithm: :concurrently if !column_exists?(:appusers, :archived)