Which is the quickest way to get the list of tables that have foreign key dependencies, both direct and indirect, to DBIx::Class subclass foo? I have a MySQL database based on a DBIx::Class::Schema. Can DBIx::Class be used directly, or can SQL::Translator help by generating a digraph?
Given the following classes:
package MySchema::Foo;
...
package MySchema::Bar;
__PACKAGE__->belongs_to('foo', 'MySchema::Foo');
package MySchema::Baz;
__PACKAGE__->belongs_to('bar', 'MySchema::Bar');
For the input Foo, the output should be [ Bar, Baz ].
Cooked this with
DBIx::Class
's::Schema
and::ResultSource
. First builds a hash(ref) of referencing classes and then traverses it: