package SQL::Translator::Schema::Constraint;
-# ----------------------------------------------------------------------
-# Copyright (C) 2002-2009 SQLFairy Authors
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA
-# -------------------------------------------------------------------
-
=pod
=head1 NAME
=cut
use strict;
+use warnings;
use SQL::Translator::Schema::Constants;
use SQL::Translator::Utils 'parse_list_arg';
use base 'SQL::Translator::Schema::Object';
-use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT);
+ our ( $TABLE_COUNT, $VIEW_COUNT );
-$VERSION = '1.59';
+our $VERSION = '1.59';
my %VALID_CONSTRAINT_TYPE = (
PRIMARY_KEY, 1,
NOT_NULL, 1,
);
-# ----------------------------------------------------------------------
-
__PACKAGE__->_attributes( qw/
table name type fields reference_fields reference_table
match_type on_delete on_update expression deferrable
$self->SUPER::init(@_);
}
-# ----------------------------------------------------------------------
sub deferrable {
=pod
return defined $self->{'deferrable'} ? $self->{'deferrable'} : 1;
}
-# ----------------------------------------------------------------------
sub expression {
=pod
return $self->{'expression'} || '';
}
-# ----------------------------------------------------------------------
sub is_valid {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub fields {
=pod
}
}
-# ----------------------------------------------------------------------
sub field_names {
=head2 field_names
return wantarray ? @{ $self->{'fields'} || [] } : ($self->{'fields'} || '');
}
-# ----------------------------------------------------------------------
sub match_type {
=pod
return $self->{'match_type'} || '';
}
-# ----------------------------------------------------------------------
sub name {
=pod
return $self->{'name'} || '';
}
-# ----------------------------------------------------------------------
sub options {
=pod
}
}
-
-# ----------------------------------------------------------------------
sub on_delete {
=pod
return $self->{'on_delete'} || '';
}
-# ----------------------------------------------------------------------
sub on_update {
=pod
return $self->{'on_update'} || '';
}
-# ----------------------------------------------------------------------
sub reference_fields {
=pod
}
}
-# ----------------------------------------------------------------------
sub reference_table {
=pod
return $self->{'reference_table'} || '';
}
-# ----------------------------------------------------------------------
sub table {
=pod
return $self->{'table'};
}
-# ----------------------------------------------------------------------
sub type {
=pod
return $self->{'type'} || '';
}
-# ----------------------------------------------------------------------
sub equals {
=pod
return 1;
}
-# ----------------------------------------------------------------------
sub DESTROY {
my $self = shift;
undef $self->{'table'}; # destroy cyclical reference
1;
-# ----------------------------------------------------------------------
-
=pod
=head1 AUTHOR