Generates a migration that adds the ancestry column (and optional cache columns) to an existing table.
$ mix ancestry_ex.gen.migration categories
$ mix ancestry_ex.gen.migration categories --cache-depth --counter-cache
$ mix ancestry_ex.gen.migration categories --from-parent-id
The ancestry column is created with the "C" collation and a btree index,
so prefix searches (LIKE '/1/2/%') use the index.
Options
--format-materialized_path2(default) ormaterialized_path.--column- name of the ancestry column,ancestryby default.--cache-depth- adds anancestry_depthinteger column.--virtual-depth- addsancestry_depthas a PostgreSQL generated column.--counter-cache- adds achildren_countinteger column.--from-parent-id- fills the new columns from an existing adjacency list column with a recursive query, so an existing tree is migrated in place.--parent-column- the adjacency list column,parent_idby default.--repo- the repo, defaults toMyApp.Repo.--migrations-path- where to write the migration, defaults to the repo'spriv/repo/migrations.