From: Justin Hunter Date: Tue, 23 Mar 2010 23:35:51 +0000 (-0700) Subject: move the class_type around X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c3653d166bc2442af935b493f853c3fe6db794fa;p=dbsrgits%2FSQL-Translator-2.0-ish.git move the class_type around --- diff --git a/lib/SQL/Translator/Parser/DDL/DBIx/Class.pm b/lib/SQL/Translator/Parser/DDL/DBIx/Class.pm index ec88e8d..d5ca1ec 100644 --- a/lib/SQL/Translator/Parser/DDL/DBIx/Class.pm +++ b/lib/SQL/Translator/Parser/DDL/DBIx/Class.pm @@ -1,15 +1,9 @@ use MooseX::Declare; -BEGIN { - use Moose::Util::TypeConstraints; - - class_type 'DBIx::Class::Schema'; - - no Moose::Util::TypeConstraints; -} role SQL::Translator::Parser::DDL::DBIx::Class { use MooseX::Types::Moose qw(); use MooseX::MultiMethods; use SQL::Translator::Constants qw(:sqlt_types :sqlt_constants); + use SQL::Translator::Types qw(DBICSchema); use aliased 'SQL::Translator::Object::Column'; use aliased 'SQL::Translator::Object::Constraint'; use aliased 'SQL::Translator::Object::ForeignKey'; @@ -20,8 +14,10 @@ role SQL::Translator::Parser::DDL::DBIx::Class { use aliased 'SQL::Translator::Object::Table'; use aliased 'SQL::Translator::Object::View'; - multi method parse(DBIx::Class::Schema $data) { $data } + multi method parse(Schema $data) { $data } multi method parse(Str $data) { } + + multi method parse(DBICSchema $data) { $data } } diff --git a/lib/SQL/Translator/Types.pm b/lib/SQL/Translator/Types.pm index 6e66ee2..4727b4b 100644 --- a/lib/SQL/Translator/Types.pm +++ b/lib/SQL/Translator/Types.pm @@ -2,7 +2,9 @@ use MooseX::Declare; class SQL::Translator::Types { 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 MatchType Parser Producer Translator)]; + Bit DBIHandle MatchType Parser Producer Translator DBICSchema)]; + + class_type DBICSchema, { class => 'DBIx::Class::Schema' };; class_type Column, { class => 'SQL::Translator::Object::Column' }; class_type Constraint, { class => 'SQL::Translator::Object::Constraint' };