|Welcome to the Monastery|
Using DBIx::Class::Schema::Loader to determine constraintsby jds17 (Pilgrim)
|on Oct 31, 2012 at 19:32 UTC||Need Help??|
jds17 has asked for the
wisdom of the Perl Monks concerning the following question:
I am quite new to DBIx::Class and would like to use DBIx::Class::Schema::Loader to retrieve information about table constraints. I must admit being a bit lost in the documentation for DBIx::Class. I have played around a bit using an SQLite database and found a way how one can get part of the information as follows:
when tested against a SQLite database containing the following three tables:
the debugger output shows the following for the array @relationships:
So it contains a lot of the information I am looking for. But apart from the fact that _relationships() starts with an underscore I am quite sure that rummaging about the innards of this data structure is not the right way to do it.
Is there a better way?
Update: I did not say exactly what information I am looking for, which is: for a specific table, I need the unique constraints/indices together with the constrained columns' names as well as all the foreign keys with constrained columns, referenced tables and referenced columns.