Sha256: 97f6383c7dd8eb8e7bf5fcdf27326bb54fdf89a8776f13cdc1a0d7ad1316dc13
Contents?: true
Size: 861 Bytes
Versions: 7
Compression:
Stored size: 861 Bytes
Contents
class CreateProclaimCommentHierarchies < ActiveRecord::Migration[5.2] def change create_table :proclaim_comment_hierarchies, :id => false do |t| # ID of the parent/grandparent/great-grandparent/etc. comments t.integer :ancestor_id, null: false # ID of the target comment t.integer :descendant_id, null: false # Number of generations between the ancestor and the descendant. # Parent/child = 1, for example. t.integer :generations, null: false end # For "all progeny of…" and leaf selects: add_index :proclaim_comment_hierarchies, [:ancestor_id, :descendant_id, :generations], :unique => true, :name => "comment_anc_desc_udx" # For "all ancestors of…" selects, add_index :proclaim_comment_hierarchies, [:descendant_id], :name => "comment_desc_idx" end end
Version data entries
7 entries across 7 versions & 1 rubygems