2016-03-29 11 views
0

データベースを本番モードで移行する際に問題が発生しました。rails migration production dbが正常に動作しない

migrationfileは次のようになります。

class ChangeCourseDefaultsNull < ActiveRecord::Migration 
def self.up 
    change_column :course_objects, :active, false, :default => 0 
end 

def self.down 
    change_column_null :course_objects, :active, true 
end 
end 

エラーが間違っていただきまし

== 20150720105700 ChangeCourseDefaultsNull: migrating ========================= 
-- change_column(:course_objects, :active, false, {:default=>0}) 
rake aborted! 
StandardError: An error has occurred, all later migrations canceled: 

undefined method `to_sym' 

のですか?

答えて

4

あなたは

class ChangeCourseDefaultsNull < ActiveRecord::Migration 
def self.up 
    change_column :course_objects, :active, :boolean, :default => 0 
end 

def self.down 
    change_column_null :course_objects, :active, :boolean 
end 
end 
など、カラム型 booleanstringを指定していません
関連する問題