aherzog: Adam Herzog <adam@herzogdesigns.com>
+ Alexander Keusch <cpan@keusch.at>
+
+amiri: Amiri Barksdale <amiri@metalabel.com>
+
amoore: Andrew Moore <amoore@cpan.org>
andyg: Andy Grundman <andy@hybridized.org>
rafl: Florian Ragwitz <rafl@debian.org>
+ rbo: Robert Bohne <rbo@cpan.org>
+
rbuels: Robert Buels <rmb32@cornell.edu>
rdj: Ryan D Johnson <ryan@innerfence.com>
use Exporter;
use SQL::Translator::Utils qw(debug normalize_name);
use Carp::Clan qw/^SQL::Translator|^DBIx::Class|^Try::Tiny/;
- use Scalar::Util ();
+ use Scalar::Util 'weaken';
use Try::Tiny;
+ use namespace::clean;
use base qw(Exporter);
sub parse {
# this is a hack to prevent schema leaks due to a retarded SQLT implementation
# DO NOT REMOVE (until SQLT2 is out, the all of this will be rewritten anyway)
- Scalar::Util::weaken ($_[1]) if ref ($_[1]);
+ weaken $_[1] if ref ($_[1]);
my ($tr, $data) = @_;
my $args = $tr->parser_args;
$dbicschema->throw_exception ("'sources' parameter must be an array or hash ref")
unless( $ref eq 'ARRAY' || ref eq 'HASH' );
- # limit monikers to those specified in
+ # limit monikers to those specified in
my $sources;
if ($ref eq 'ARRAY') {
$sources->{$_} = 1 for (@$limit_sources);
# Force the order of @cond to match the order of ->add_columns
my $idx;
my %other_columns_idx = map {'foreign.'.$_ => ++$idx } $relsource->columns;
- my @cond = sort { $other_columns_idx{$a} cmp $other_columns_idx{$b} } keys(%{$rel_info->{cond}});
+ my @cond = sort { $other_columns_idx{$a} cmp $other_columns_idx{$b} } keys(%{$rel_info->{cond}});
# Get the key information, mapping off the foreign/self markers
my @refkeys = map {/^\w+\.(\w+)$/} @cond;
my $dependencies = {
map { $_ => _resolve_deps ($_, \%tables) } (keys %tables)
};
+
for my $table (sort
{
keys %{$dependencies->{$a} || {} } <=> keys %{ $dependencies->{$b} || {} }
}
my %views;
- foreach my $moniker (sort keys %view_monikers)
+
+ my @view_sources =
+ sort {
+ keys %{ $a->deploy_depends_on || {} }
+ <=>
+ keys %{ $b->deploy_depends_on || {} }
+ ||
+ $a->source_name cmp $b->source_name
+ }
+ map { $dbicschema->source($_) }
+ keys %view_monikers;
+
+ foreach my $source (@view_sources)
{
- my $source = $dbicschema->source($moniker);
my $view_name = $source->name;
# FIXME - this isn't the right way to do it, but sqlt does not
L<SQL::Translator>, L<DBIx::Class::Schema>
-=head1 AUTHORS
+=head1 AUTHOR
+
+Jess Robinson
+
+=head2 CONTRIBUTORS
-See L<DBIx::Class/CONTRIBUTORS>.
+Matt Trout
+Ash Berlin
+Amiri Barksdale
=head1 LICENSE