method

change_column_default

change_column_default(table_name, column_name, default)
public

Sets a new default value for a column. If you want to set the default value to NULL, you are out of luck. You need to DatabaseStatements#execute the appropriate SQL statement yourself.

Examples
 change_column_default(:suppliers, :qualification, 'new')
 change_column_default(:accounts, :authorized, 1)

3Notes

Implemented in database adapters

mutru · Oct 10, 20088 thanks

These methods are not implemented in the abstract classes. Instead, all database adapters implement these separately, if the feature is supported.

How to set default value to NULL

Vidmantas · Jul 30, 20092 thanks

To set default value to NULL you can use change_column method instead, for example:

change_column :suppliers, :qualification, :string, :default => nil

Just make sure you don't change data type accidentally ;-)

change_column did the trick for me

meritize · Jul 19, 2014

Use change_column, and make sure to specify the datatype:

class ChangeUsers < ActiveRecord::Migration
def up
	change_column :users, :is_vote_reminder, :boolean, :default => true
end
end