Sha256: d4f3a88f96e606796dd6624aa5e99a3269fc64dd8e2a8317066abb6107d53274

Contents?: true

Size: 580 Bytes

Versions: 6

Compression:

Stored size: 580 Bytes

Contents

class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
  def change
    create_table :<%= migration_name %>, id: false do |t|
      t.<%= primary_key_type %> :ancestor_id, null: false
      t.<%= primary_key_type %> :descendant_id, null: false
      t.integer :generations, null: false
    end

    add_index :<%= migration_name %>, [:ancestor_id, :descendant_id, :generations],
      unique: true,
      name: "<%= file_name %>_anc_desc_idx"

    add_index :<%= migration_name -%>, [:descendant_id],
      name: "<%= file_name %>_desc_idx"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
closure_tree-7.4.0 lib/generators/closure_tree/templates/create_hierarchies_table.rb.erb
closure_tree-7.4.0.rc1 lib/generators/closure_tree/templates/create_hierarchies_table.rb.erb
closure_tree-7.3.0 lib/generators/closure_tree/templates/create_hierarchies_table.rb.erb
closure_tree-7.2.0 lib/generators/closure_tree/templates/create_hierarchies_table.rb.erb
closure_tree-7.1.0 lib/generators/closure_tree/templates/create_hierarchies_table.rb.erb
closure_tree-7.0.0 lib/generators/closure_tree/templates/create_hierarchies_table.rb.erb