Sha256: 224da35097517b5acfb104077f1940869dc0b2ae14ac9a149024eaa688f4db80

Contents?: true

Size: 648 Bytes

Versions: 4

Compression:

Stored size: 648 Bytes

Contents

class AddStatesmanTo<%= migration_class_name %> < ActiveRecord::Migration
  def change
    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, 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
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
statesman-1.1.0 lib/generators/statesman/templates/update_migration.rb.erb
statesman-1.0.0 lib/generators/statesman/templates/update_migration.rb.erb
statesman-1.0.0.beta2 lib/generators/statesman/templates/update_migration.rb.erb
statesman-1.0.0.beta1 lib/generators/statesman/templates/update_migration.rb.erb