sqlserver2014: db:migrate failed
Added by 刘 彤彤 almost 9 years ago
Redmine-3.3.1、ruby 2.3.1p112、sqlserver2014.
run commond:db:migrate
errors as flow:
20160404080304 ForcePasswordResetDuringSetup: migrating ==================
20160404080304 ForcePasswordResetDuringSetup: migrated (0.0126s) ========= 20160416072926 RemovePositionDefaults: migrating =========================
-- change_column("boards", :position, :integer, {:default=>nil})
> 0.0541s
- change_column("custom_fields", :position, :integer, {:default=>nil})
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
undefined method `type' for nil:NilClass/opt/redmine-3.3.1/db/migrate/20160416072926_remove_position_defaults.rb:4:in `block in up'
/opt/redmine-3.3.1/db/migrate/20160416072926_remove_position_defaults.rb:3:in `each'
/opt/redmine-3.3.1/db/migrate/20160416072926_remove_position_defaults.rb:3:in `up'
NoMethodError: undefined method `type' for nil:NilClass
/opt/redmine-3.3.1/db/migrate/20160416072926_remove_position_defaults.rb:4:in `block in up'
/opt/redmine-3.3.1/db/migrate/20160416072926_remove_position_defaults.rb:3:in `each'
/opt/redmine-3.3.1/db/migrate/20160416072926_remove_position_defaults.rb:3:in `up'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
the content of 20160416072926_remove_position_defaults.rb is:
class RemovePositionDefaults < ActiveRecord::Migration
def up
[Board, CustomField, Enumeration, IssueStatus, Role, Tracker].each do |klass|
change_column klass.table_name, :position, :integer, :default => nil
end
end
def down
[Board, CustomField, Enumeration, IssueStatus, Role, Tracker].each do |klass|
change_column klass.table_name, :position, :integer, :default => 1
end
end
end
I delete table CustomField,It's ok and work well.