Add ancestry column to a database table
masterGenerate a migration to add the ancestry column to your table. Use the t.ancestry helper in your migration to automatically create the column with the correct type, collation, and indexes. You can pass options to this helper for cached columns and ancestry formats.
class AddAncestryToTable < ActiveRecord::Migration[7.0]
def change
change_table(:table) do |t|
t.ancestry
# t.ancestry format: :materialized_path3, cache_depth: true, parent: true, counter_cache: true
end
end
end