Sha256: adbaf9b4611d6c3cb1f30263d477394335dc428f41efe2b54327941620668195

Contents?: true

Size: 856 Bytes

Versions: 17

Compression:

Stored size: 856 Bytes

Contents

class CreateProclaimCommentHierarchies < ActiveRecord::Migration
	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

17 entries across 17 versions & 1 rubygems

Version Path
proclaim-0.5.6 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.5.5 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.5.3 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.5.2 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.5.1 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.5.0 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.4.0 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.3.1 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.3.0 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.2.4 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.2.2 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.2.1 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.2.0 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.1.3 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.1.2 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.1.1 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb
proclaim-0.1.0 db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb