Give the Context.state column a default value of 'active'

SQLite does not permit a NOT NULL column to have default value NULL.
This commit is contained in:
Dan Rice 2013-03-02 03:02:05 -05:00
parent ae42f9c076
commit 560f2ff538

View file

@ -4,7 +4,7 @@ class AddStateToContext < ActiveRecord::Migration
end
def up
add_column :contexts, :state, :string, :limit => 20, :null => false
add_column :contexts, :state, :string, :limit => 20, :null => false, :default => 'active'
Context.reset_column_information
Context.all.each do |c|
c.state = c.hide ? 'hidden' : 'active'