Sha256: bcbf63fb2d187860c72ffe2a1f6e3797c99342fbd1d733a8ed96e271aad1b583

Contents?: true

Size: 742 Bytes

Versions: 16

Compression:

Stored size: 742 Bytes

Contents

class MonarchyCreateHierarchies < ActiveRecord::Migration
  def change
    create_table :monarchy_hierarchies do |t|
      t.integer :parent_id
      t.integer :resource_id, null: false
      t.string :resource_type, null: false
      t.timestamps null: false
    end

    create_table :monarchy_hierarchy_hierarchies, id: false do |t|
      t.integer :ancestor_id, null: false
      t.integer :descendant_id, null: false
      t.integer :generations, null: false
    end

    add_index :monarchy_hierarchy_hierarchies, [:ancestor_id, :descendant_id, :generations],
              unique: true,
              name: 'hierarchy_anc_desc_idx'

    add_index :monarchy_hierarchy_hierarchies, [:descendant_id], name: 'hierarchy_desc_idx'
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
monarchy-2.7.0 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.6.1 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.6.0 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.5.0 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.4.0 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.3.0 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.2.2 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.2.1 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.2.0 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.1.0 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.0.8 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.0.7 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.0.6 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.0.5 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.0.4 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb
monarchy-2.0.0.pre.beta.1 dummy/db/migrate/20160221132205_monarchy_create_hierarchies.rb