Sha256: 4b8d0a1981f522064c87b7efe045d8b6c449125d1f909467255745c7a6a2efee

Contents?: true

Size: 1001 Bytes

Versions: 9

Compression:

Stored size: 1001 Bytes

Contents

class AddZuulRoleTo<%= table_name.camelize %> < ActiveRecord::Migration
  def self.up
    change_table(:<%= table_name %>) do |t|
<%= migration_data -%>

<% attributes.each do |attribute| -%>
      t.<%= attribute.type %> :<%= attribute.name %>
<% end -%>

      # Uncomment below if timestamps were not included in your original model.
      # t.timestamps
    end

    add_index :<%= table_name %>, :slug
    add_index :<%= table_name %>, :level
    add_index :<%= table_name %>, :context_type
    add_index :<%= table_name %>, :context_id
    add_index :<%= table_name %>, [:slug, :context_type, :context_id],  :unique => true
    add_index :<%= table_name %>, [:level, :context_type, :context_id], :unique => true
  end

  def self.down
    # By default, we don't want to make any assumption about how to roll back a migration when your
    # model already existed. Please edit below which fields you would like to remove in this migration.
    raise ActiveRecord::IrreversibleMigration
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
zuul-0.2.8 lib/generators/zuul/templates/role_existing.rb
zuul-0.2.7 lib/generators/zuul/templates/role_existing.rb
zuul-0.2.6 lib/generators/zuul/templates/role_existing.rb
zuul-0.2.5 lib/generators/zuul/templates/role_existing.rb
zuul-0.2.4 lib/generators/zuul/templates/role_existing.rb
zuul-0.2.3 lib/generators/zuul/templates/role_existing.rb
zuul-0.2.2 lib/generators/zuul/templates/role_existing.rb
zuul-0.2.1 lib/generators/zuul/templates/role_existing.rb
zuul-0.2.0 lib/generators/zuul/templates/role_existing.rb