ruby-on-rails rails migration error“错误的元素数”

qlvxas9a  于 12个月前  发布在  Ruby
关注(0)|答案(1)|浏览(121)

无法迁移,面临此错误StandardError:发生错误,此迁移和所有后续迁移已取消:

Caused by:
ArgumentError: wrong number of arguments (given 2, expected 1)
/home/ciaranmurphy/cashanalytics/db/migrate/20130614160852_add_first_name_last_name_user_type_values_to_user.rb:3:in `change'
/home/ciaranmurphy/cashanalytics/lib/tasks/multitenant.rake:32:in `block (2 levels) in <top (required)>'
/home/ciaranmurphy/cashanalytics/lib/tasks/multitenant.rake:18:in `block in migrate_each'
/home/ciaranmurphy/cashanalytics/app/services/tenant.rb:132:in `with_public'
/home/ciaranmurphy/cashanalytics/lib/tasks/multitenant.rake:16:in `migrate_each'
/home/ciaranmurphy/cashanalytics/lib/tasks/multitenant.rake:31:in `block in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

字符串
尝试了迁移和跟踪,但没有解决问题

5us2dqdw

5us2dqdw1#

没有实际的迁移文件很难说,但请确保您的cashanalytics/db/migrate/20130614160852_add_first_name_last_name_user_type_values_to_user.rb文件看起来像这样:

class AddFirstNameLastNameUserTypeValuesToUser < ActiveRecord::Migration[7.1]
  def change
    add_column :user, :first_name, :string
    add_column :user, :last_name, :string
    # guessing the data type here.May also be a reference.
    add_column :user, :user_type, :integer
  end
end

字符串

相关问题