Use ancestry plugin

This gives us useful methods for dealing with parents and children and
allows us to write less code ourselves.
Disallow cyclic group graphs

Thanks to the magic of the ancestry plugin, this is now forbidden
without any additional work.
Migrate parent_id to ancestry

Ancestry provides a method to perform this migration, but it doesn't
work.