package SQL::Translator::Object::Column;
use Moose;
+use MooseX::Types::Moose qw(Bool Int Str);
+use SQL::Translator::Types qw(Trigger);
-has 'name' => (is => 'ro', isa => 'Str', required => 1);
-has 'type' => (is => 'ro', isa => 'Str', required => 1);
-has 'size' => (is => 'ro', isa => 'Int', required => 1);
-has 'nullable' => (is => 'ro', isa => 'Bool', required => 1, default => 1);
-has 'default' => (is => 'ro', isa => 'Str', required => 0);
-has 'trigger' => (is => 'ro', isa => 'SQL::Translator::Object::Trigger', required => 0);
+has 'name' => (is => 'ro', isa => Str, required => 1);
+has 'type' => (is => 'ro', isa => Str, required => 1);
+has 'size' => (is => 'ro', isa => Int, required => 1);
+has 'nullable' => (is => 'ro', isa => Bool, required => 1, default => 1);
+has 'default' => (is => 'ro', isa => Str, required => 0);
+has 'trigger' => (is => 'ro', isa => Trigger, required => 0);
1;
package SQL::Translator::Object::Constraint;
use Moose;
-use SQL::Translator::Types;
+use MooseX::Types::Moose qw(ArrayRef Str);
+use SQL::Translator::Types qw(Column);
-has 'name' => (is => 'ro', isa => 'Str', required => 1);
-has 'columns' => (is => 'ro', isa => 'ArrayRef[Column]', required => 1);
-has 'type' => (is => 'ro', isa => 'Str', required => 1);
+has 'name' => (is => 'ro', isa => Str, required => 1);
+has 'columns' => (is => 'ro', isa => ArrayRef[Column], required => 1);
+has 'type' => (is => 'ro', isa => Str, required => 1);
1;
package SQL::Translator::Object::Index;
use Moose;
-use SQL::Translator::Types;
+use MooseX::Types::Moose qw(ArrayRef Str);
+use SQL::Translator::Types qw(Column);
-has 'name' => (is => 'ro', isa => 'Str', required => 1);
-has 'columns' => (is => 'ro', isa => 'ArrayRef[Column]', required => 1);
-has 'type' => (is => 'ro', isa => 'Str', required => 1);
+has 'name' => (is => 'ro', isa => Str, required => 1);
+has 'columns' => (is => 'ro', isa => ArrayRef[Column], required => 1);
+has 'type' => (is => 'ro', isa => Str, required => 1);
1;
package SQL::Translator::Object::Procedure;
use Moose;
+use MooseX::Types::Moose qw(Str);
+use SQL::Translator::Types qw();
-has 'name' => (is => 'ro', isa => 'Str', required => 1);
-has 'contents' => (is => 'ro', isa => 'Str', required => 1);
+has 'name' => (is => 'ro', isa => Str, required => 1);
+has 'contents' => (is => 'ro', isa => Str, required => 1);
1;
package SQL::Translator::Object::Schema;
use Moose;
-use SQL::Translator::Types;
+use MooseX::Types::Moose qw(ArrayRef);
+use SQL::Translator::Types qw(Procedure Table View);
-has 'tables' => (is => 'ro', isa => 'ArrayRef[Table]', required => 1);
-has 'views' => (is => 'ro', isa => 'ArrayRef[View]', required => 0);
-has 'procedures' => (is => 'ro', isa => 'ArrayRef[Procedure]', required => 0);
+has 'tables' => (is => 'ro', isa => ArrayRef[Table], required => 1);
+has 'views' => (is => 'ro', isa => ArrayRef[View], required => 0);
+has 'procedures' => (is => 'ro', isa => ArrayRef[Procedure], required => 0);
1;
package SQL::Translator::Object::Table;
use Moose;
-use SQL::Translator::Types;
+use MooseX::Types::Moose qw(ArrayRef Str);
+use SQL::Translator::Types qw(Column Constraint Index);
-has 'name' => (is => 'ro', isa => 'Str', required => 1);
-has 'columns' => (is => 'ro', isa => 'ArrayRef[Column]', required => 1);
-has 'indexes' => (is => 'ro', isa => 'ArrayRef[Index]', required => 0);
-has 'constraints' => (is => 'ro', isa => 'ArrayRef[Constraint]', required => 0);
+has 'name' => (is => 'ro', isa => Str, required => 1);
+has 'columns' => (is => 'ro', isa => ArrayRef[Column], required => 1);
+has 'indexes' => (is => 'ro', isa => ArrayRef[Index], required => 0);
+has 'constraints' => (is => 'ro', isa => ArrayRef[Constraint], required => 0);
1;
package SQL::Translator::Object::Trigger;
use Moose;
+use MooseX::Types::Moose qw(Str);
+use SQL::Translator::Types qw();
-has 'name' => (is => 'ro', isa => 'Str', required => 1);
+has 'name' => (is => 'ro', isa => Str, required => 1);
1;
package SQL::Translator::Object::View;
use Moose;
+use MooseX::Types::Moose qw(ArrayRef);
+use SQL::Translator::Types qw();
extends 'SQL::Translator::Object::Table';
-has 'sql' => (is => 'ro', isa => 'Str', required => 1);
+
+has 'sql' => (is => 'ro', isa => Str, required => 1);
1;
package SQL::Translator::Types;
-use MooseX::Types -declare => [qw(Column Constraint Index Procedure Schema Table Trigger View)];
+use MooseX::Types -declare, [qw(Column Constraint Index Procedure Schema Table Trigger View)];
-subtype Column => as 'SQL::Translator::Object::Column';
-subtype Constraint => as 'SQL::Translator:Object::Constraint';
-subtype Index => as 'SQL::Translator:Object::Index';
-subtype Procedure => as 'SQL::Translator:Object::Procedure';
-subtype Schema => as 'SQL::Translator:Object::Schema';
-subtype Table => as 'SQL::Translator::Object::Table';
-subtype Trigger => as 'SQL::Translator:Object::Trigger';
-subtype View => as 'SQL::Translator:Object::View';
+class_type Column, { class => 'SQL::Translator::Object::Column' };
+class_type Constraint, { class => 'SQL::Translator:Object::Constraint' };
+class_type Index, { class => 'SQL::Translator:Object::Index' };
+class_type Procedure, { class => 'SQL::Translator:Object::Procedure' };
+class_type Schema, { class => 'SQL::Translator:Object::Schema' };
+class_type Table, { class => 'SQL::Translator::Object::Table' };
+class_type Trigger, { class => 'SQL::Translator:Object::Trigger' };
+class_type View, { class => 'SQL::Translator:Object::View' };
1;