From: Justin Hunter Date: Tue, 22 Sep 2009 00:35:33 +0000 (-0700) Subject: coerce a Column from a HashRef via Column->new X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5910913172b1bde9356732f2c728a05122a282cb;p=dbsrgits%2FSQL-Translator-2.0-ish.git coerce a Column from a HashRef via Column->new --- diff --git a/lib/SQL/Translator/Types.pm b/lib/SQL/Translator/Types.pm index fd61352..b21afd9 100644 --- a/lib/SQL/Translator/Types.pm +++ b/lib/SQL/Translator/Types.pm @@ -1,6 +1,6 @@ use MooseX::Declare; class SQL::Translator::Types { - use MooseX::Types::Moose qw(ArrayRef CodeRef Int Maybe Str Undef); + use MooseX::Types::Moose qw(ArrayRef CodeRef HashRef Int Maybe Str Undef); use MooseX::Types -declare, [qw(Column Constraint ForeignKey Index PrimaryKey Procedure Schema Sequence Table Trigger View Bit DBIHandle ColumnSize Parser Producer Translator)]; @@ -20,6 +20,9 @@ class SQL::Translator::Types { class_type Producer, { class => 'SQL::Translator::Producer' }; class_type Translator, { class => 'SQL::Translator' }; + coerce Column, + from HashRef, via { SQL::Translator::Object::Column->new($_) }; + subtype Bit, as Int, where { $_ == 1 || $_ == 0 }; coerce Bit, from Undef, via { 0 },