3357c38a5ba49cd8006717a55f3d3beeb402fab5
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Schema / Graph / Edge.pm
1 package SQL::Translator::Schema::Graph::Edge;
2
3 use strict;
4
5 use vars qw[ $VERSION ];
6 $VERSION = '1.60';
7
8 use Class::MakeMethods::Template::Hash (
9     new    => ['new'],
10     scalar => [qw( type )],
11     array  => [qw( traversals )],
12     object => [
13         'thisfield' => { class => 'SQL::Translator::Schema::Field' },    #FIXME
14         'thatfield' => { class => 'SQL::Translator::Schema::Field' },    #FIXME
15         'thisnode'  => { class => 'SQL::Translator::Schema::Graph::Node' },
16         'thatnode'  => { class => 'SQL::Translator::Schema::Graph::Node' },
17
18     ],
19 );
20
21 sub flip {
22     my $self = shift;
23
24     return SQL::Translator::Schema::Graph::Edge->new(
25         thisfield => $self->thatfield,
26         thatfield => $self->thisfield,
27         thisnode  => $self->thatnode,
28         thatnode  => $self->thisnode,
29         type      => $self->type eq 'import' ? 'export' : 'import'
30     );
31 }
32
33 1;