lib/generators/statesman/templates/update_migration.rb.erb in statesman-0.8.3 vs lib/generators/statesman/templates/update_migration.rb.erb in statesman-1.0.0.beta1
- old
+ new
@@ -1,10 +1,10 @@
class AddStatesmanTo<%= migration_class_name %> < ActiveRecord::Migration
def change
- add_column :<%= table_name %>, :to_state, :string
+ add_column :<%= table_name %>, :to_state, :string, null: false
add_column :<%= table_name %>, :metadata, :text<%= ", default: \"{}\"" unless mysql? %>
- add_column :<%= table_name %>, :sort_key, :integer
- add_column :<%= table_name %>, :<%= parent_id %>, :integer
+ add_column :<%= table_name %>, :sort_key, :integer, null: false
+ add_column :<%= table_name %>, :<%= parent_id %>, :integer, null: false
add_column :<%= table_name %>, :created_at, :datetime
add_column :<%= table_name %>, :updated_at, :datetime
add_index :<%= table_name %>, :<%= parent_id %>
add_index :<%= table_name %>, [:sort_key, :<%= parent_id %>], unique: true