Foreign key on the same table testing

it isn't clear if your'e doing single table inheritance (STI) or a
acts_as_nested_set (or acts_as_tree) structure, but these are both
well-established techniques with constraints on column names, if you
do a search for them