package SQL::Translator::Producer::Turnkey;
# -------------------------------------------------------------------
-# $Id: Turnkey.pm,v 1.36 2004-04-06 08:50:32 boconnor Exp $
+# $Id: Turnkey.pm,v 1.37 2004-04-07 19:21:27 allenday Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use strict;
use vars qw[ $VERSION $DEBUG ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.36 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.37 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 1 unless defined $DEBUG;
use SQL::Translator::Schema::Constants;
sub [% edge.thatnode.table.name %]s { return shift->[% edge.thatnode.table.name %]_[% edge.thatfield.name %] }
[% END %]
[% END %]
+
[% END %]
[% END %]
#[% thisnode.name %]::[% h.thisfield_index(i).name %] -> [% h.vianode.name %]::[% h.thisviafield_index(i).name %] ... [% h.vianode.name %]::[% h.thatviafield_index(j).name %] <- [% h.thatnode_index(j).name %]::[% h.thatfield_index(j).name %]
sub [% h.vianode.table.name %]_[% format_fk(h.vianode,h.thisviafield_index(i).name) %]_[% format_fk(h.vianode,h.thatviafield_index(j).name) %]s { my \$self = shift; return map \$_->[% %], \$self->[% %] }
[% j = j + 1 %]
-
[% END %]
[% i = i + 1 %]
[% END %]
use strict;
use Data::Dumper;
+$Data::Dumper::Maxdepth = 3;
use SQL::Translator::Schema::Graph::Node;
use SQL::Translator::Schema::Graph::Edge;
thatfield => $self->translator->schema->get_table($field->foreign_key_reference->reference_table)->get_field(($field->foreign_key_reference->reference_fields)[0])
);
-# $node->edgecount($that->name, $node->edgecount($that->name)+1);
$node->edgecount($that->name, $node->edgecount($that->name)+1);
$node->has($that->name, $node->has($that->name)+1);
$that->many($node->name, $that->many($node->name)+1);
-# $that->edgecount($node->name, $that->edgecount($node->name)+1);
$that->edgecount($node->name, $that->edgecount($node->name)+1);
#warn "\t" . $node->name . "\t" . $node->edgecount($that->name);
$inode1->via($inode2->name,$inode1->via($inode2->name)+1);
$inode2->via($inode1->name,$inode2->via($inode1->name)+1);
}
+#warn Dumper($cedge);
$inode1->push_compoundedges($cedge);
$inode2->push_compoundedges($cedge) unless $inode1 eq $inode2;
+# if($inode1->name ne $inode2->name){
+# my $flipped_cedge = $cedge;
+# foreach my $flipped_cedge_edge ($flipped_cedge->edges){
+# warn Dumper $flipped_cedge_edge;
+# warn "\t". Dumper $flipped_cedge_edge->flip;
+# }
+# }
}
}
}