lib/generators/statesman/templates/update_migration.rb.erb in statesman-3.0.0 vs lib/generators/statesman/templates/update_migration.rb.erb in statesman-3.1.0
- old
+ new
@@ -1,8 +1,8 @@
-class AddStatesmanTo<%= migration_class_name %> < ActiveRecord::Migration
+class AddStatesmanTo<%= migration_class_name %> < ActiveRecord::Migration<%= "[#{ActiveRecord::Migration.current_version}]" if Statesman::Utils.rails_5_or_higher? %>
def change
add_column :<%= table_name %>, :to_state, :string, null: false
- add_column :<%= table_name %>, :metadata, :text<%= ", default: \"{}\"" unless mysql? %>
+ add_column :<%= table_name %>, :metadata, :text<%= ", default: #{metadata_default_value}" unless mysql? %>
add_column :<%= table_name %>, :sort_key, :integer, null: false
add_column :<%= table_name %>, :<%= parent_id %>, :integer, null: false
add_column :<%= table_name %>, :most_recent, null: false
add_column :<%= table_name %>, :created_at, :datetime, null: false
add_column :<%= table_name %>, :updated_at, :datetime, null: false