Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in migrations with ruby 3.0.2 and Rails 6.1.3.2 #123

Closed
amicojeko opened this issue Nov 24, 2021 · 3 comments
Closed

error in migrations with ruby 3.0.2 and Rails 6.1.3.2 #123

amicojeko opened this issue Nov 24, 2021 · 3 comments
Labels

Comments

@amicojeko
Copy link
Contributor

the migration code is

class AddSkipAutomationsToLogframe < ActiveRecord::Migration[6.1]
  def change
    add_column :logframe_logframes, :skip_automations, :boolean, default: false
    add_column :logframe_expectations, :skip_automations, :boolean, default: false
  end
end

ad fails with

== 20210727121916 AddSkipAutomationsToLogframe: migrating =====================
-- add_column(:logframe_logframes, :skip_automations, :boolean, {:default=>false})
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

wrong number of arguments (given 4, expected 3)
/home/jeko/Workspace/orms/db/migrate/20210727121916_add_skip_automations_to_logframe.rb:3:in `change'
/home/jeko/Workspace/orms/bin/rails:9:in `<top (required)>'
/home/jeko/Workspace/orms/bin/spring:15:in `require'
/home/jeko/Workspace/orms/bin/spring:15:in `<top (required)>'

Caused by:
ArgumentError: wrong number of arguments (given 4, expected 3)
/home/jeko/Workspace/orms/db/migrate/20210727121916_add_skip_automations_to_logframe.rb:3:in `change'
/home/jeko/Workspace/orms/bin/rails:9:in `<top (required)>'
/home/jeko/Workspace/orms/bin/spring:15:in `require'
/home/jeko/Workspace/orms/bin/spring:15:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
@amicojeko
Copy link
Contributor Author

p.s. model logframe has timegate and has no temporal table

@tagliala tagliala added the bug label Nov 24, 2021
@tagliala
Copy link
Member

tagliala commented Nov 24, 2021

It happens when you add parameters to add_column, we should confirm that there is a spec trying to

  • add_column :users, :active, :boolean
  • add_column :users, :active, :boolean, default: false

We should also check for remove_index and add_index

Ref: 0d28a60, 0d28a60

@amicojeko
Copy link
Contributor Author

try also
rename_column :logframe_logframes, :skip_automations, :editable_past_values

change_column_null :journals, :project_id, true

tagliala added a commit that referenced this issue Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants