App-mkfeyorm
view release on metacpan or search on metacpan
lib/App/mkfeyorm.pm view on Meta::CPAN
}
else {
$schema = Fey::Loader->new( dbh => $source->dbh )->make_schema;
}
[% ELSE -%]
my $schema = Fey::Loader->new( dbh => $source->dbh )->make_schema;
[% END -%]
return if ref($schema) ne 'Fey::Schema';
[% IF CACHE -%]
my $updated;
[% END -%]
if ($params{fk_relations}) {
[% IF CACHE -%]
++$updated;
[% END -%]
for my $relation ( @{ $params{fk_relations} } ) {
my $source_table = $relation->{source_table};
my $source_column = $relation->{source_column};
my $target_table = $relation->{target_table};
my $target_column = $relation->{target_column};
my $fk = Fey::FK->new(
source_columns => $schema->table($source_table)->column($source_column),
target_columns => $schema->table($target_table)->column($target_column),
lib/App/mkfeyorm.pm view on Meta::CPAN
#my $fk;
#
#$fk = Fey::FK->new(
# source_columns => $schema->table('src_table')->column('col_id'),
# target_columns => $schema->table('dest_table')->column('col_id'),
#);
#$schema->add_foreign_key($fk);
[% IF CACHE -%]
if ($params{cache_file}) {
if (!-e $params{cache_file} || $updated) {
my $dirname = dirname($params{cache_file});
make_path($dirname) unless -e $dirname;
store($schema, $params{cache_file});
}
}
[% END -%]
has_schema $schema;
__PACKAGE__->DBIManager->add_source($source);
( run in 0.247 second using v1.01-cache-2.11-cpan-05444aca049 )