[Dbix-class] DBIx-Table-TestDataGenerator-0.001 released
Peter Rabbitson
rabbit+dbic at rabbit.us
Thu Nov 1 08:22:51 GMT 2012
On Wed, Oct 31, 2012 at 10:24:04PM +0100, "José Diaz Seng" wrote:
> Hi,
>
> I spent some time reading documentation about DBIC Schema Loader and DBIC in
> general (hard stuff for newcomers to DBIC...) and wrote a little program that uses
> Schema Loader to load the schema of a little SQLite test database.
>
> I found out how to get one of the metadata information I am interested in, namely
> foreign keys, the constrained columns, the referenced tables and the referenced
> columns. But I am quite sure this is not the way one should do it since I am
> digging bits of information out of a data structure I get when calling a method
> whose name starts with an underscore... Here is what I did:
>
my $schema = Blah::Schema->connect;
for my $rsrc_name ($schema->sources) {
my $rsrc = $schema->source($rsrc_name);
for my $rel_name ($rsrc->relationships) {
my $relinfo = $rsrc->relationship_info($rel_name);
...
}
}
Also note that there is a stalled (lack of tuits) branch[1] which
implements a $schema->source_tree() which will return all of the above
in one swoop. If you have the time - please help. The "todo" list is
here [2]. If you have further questions - talk to frew on IRC[3].
Cheers
[1] https://github.com/dbsrgits/dbix-class/tree/topic/factor-out-source-tree
[2] https://github.com/dbsrgits/dbix-class/blob/topic/factor-out-source-tree/TO_MERGE
[3] https://metacpan.org/module/DBIx::Class#GETTING-HELP-SUPPORT
More information about the DBIx-Class
mailing list