Sha256: 9a4ceab9a7dcaeea3c7572235f3ce4e729ec7b12039d4695e01ce78f56a5ec89

Contents?: true

Size: 478 Bytes

Versions: 4

Compression:

Stored size: 478 Bytes

Contents

class Create<%= migration_class_name %> < ActiveRecord::Migration
  def change
    create_table :<%= table_name %> do |t|
      t.string :to_state, null: false
      t.text :metadata<%= ", default: \"{}\"" unless mysql? %>
      t.integer :sort_key, null: false
      t.integer :<%= parent_id %>, null: false
      t.timestamps
    end

    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/create_migration.rb.erb
statesman-1.0.0 lib/generators/statesman/templates/create_migration.rb.erb
statesman-1.0.0.beta2 lib/generators/statesman/templates/create_migration.rb.erb
statesman-1.0.0.beta1 lib/generators/statesman/templates/create_migration.rb.erb