From: Justin Hunter Date: Sat, 3 Oct 2009 04:51:51 +0000 (-0700) Subject: coerce Sequence and Constraint into objects X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=78963c00e6027d0c2743f6a56f66dbf2cc38c91c;p=dbsrgits%2FSQL-Translator-2.0-ish.git coerce Sequence and Constraint into objects --- diff --git a/lib/SQL/Translator/Object/Table.pm b/lib/SQL/Translator/Object/Table.pm index 3c180ba..9bd05bc 100644 --- a/lib/SQL/Translator/Object/Table.pm +++ b/lib/SQL/Translator/Object/Table.pm @@ -95,7 +95,7 @@ class SQL::Translator::Object::Table extends SQL::Translator::Object is dirty { return $self->$orig($column->name, $column); } - around add_constraint(Constraint $constraint) { + around add_constraint(Constraint $constraint does coerce) { my $name = $constraint->name; if ($name eq '') { my $idx = 0; @@ -117,7 +117,7 @@ class SQL::Translator::Object::Table extends SQL::Translator::Object is dirty { $self->$orig($name, $index) } - around add_sequence(Sequence $sequence) { $self->$orig($sequence->name, $sequence) } + around add_sequence(Sequence $sequence does coerce) { $self->$orig($sequence->name, $sequence) } multi method primary_key(Any $) { grep /^PRIMARY KEY$/, $_->type for $self->get_constraints } multi method primary_key(Str $column) { $self->get_column($column)->is_primary_key(1) }