From: Justin Hunter Date: Fri, 5 Jun 2009 21:40:46 +0000 (-0700) Subject: a stupid typo and some additions X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bbdcd43eab7e71618be136f2926cd356a7842bc9;p=dbsrgits%2FSQL-Translator-2.0-ish.git a stupid typo and some additions --- diff --git a/lib/SQL/Translator/Object/Column.pm b/lib/SQL/Translator/Object/Column.pm index 87fda18..180e978 100644 --- a/lib/SQL/Translator/Object/Column.pm +++ b/lib/SQL/Translator/Object/Column.pm @@ -6,8 +6,9 @@ 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 'is_nullable' => (is => 'ro', isa => Bool, required => 1, default => 1); +has 'is_auto_increment' => (is => 'ro', isa => Bool, required => 0, default => 0); +has 'default_value' => (is => 'ro', isa => Str, required => 0); has 'trigger' => (is => 'ro', isa => Trigger, required => 0); 1; diff --git a/lib/SQL/Translator/Object/Schema.pm b/lib/SQL/Translator/Object/Schema.pm index babad8f..88710d2 100644 --- a/lib/SQL/Translator/Object/Schema.pm +++ b/lib/SQL/Translator/Object/Schema.pm @@ -1,9 +1,10 @@ package SQL::Translator::Object::Schema; use Moose; -use MooseX::Types::Moose qw(ArrayRef); +use MooseX::Types::Moose qw(ArrayRef Str); use SQL::Translator::Types qw(Procedure Table View); -has 'tables' => (is => 'ro', isa => ArrayRef[Table], required => 1); +has 'name' => (is => 'ro', isa => Str, required => 1, default => '__DEFAULT__'); +has 'tables' => (is => 'ro', isa => ArrayRef[Table], required => 0); has 'views' => (is => 'ro', isa => ArrayRef[View], required => 0); has 'procedures' => (is => 'ro', isa => ArrayRef[Procedure], required => 0); diff --git a/lib/SQL/Translator/Object/Table.pm b/lib/SQL/Translator/Object/Table.pm index da83e8e..62baaab 100644 --- a/lib/SQL/Translator/Object/Table.pm +++ b/lib/SQL/Translator/Object/Table.pm @@ -1,11 +1,13 @@ package SQL::Translator::Object::Table; use Moose; use MooseX::Types::Moose qw(ArrayRef Str); -use SQL::Translator::Types qw(Column Constraint Index); +use SQL::Translator::Types qw(Column Constraint Index Schema); +use SQL::Translator::Object::Schema; 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 'schema' => (is => 'ro', isa => Schema, required => 1, default => sub { SQL::Translator::Object::Schema->new } ); 1; diff --git a/lib/SQL/Translator/Types.pm b/lib/SQL/Translator/Types.pm index 2fd0ba7..7625f85 100644 --- a/lib/SQL/Translator/Types.pm +++ b/lib/SQL/Translator/Types.pm @@ -2,12 +2,12 @@ package SQL::Translator::Types; use MooseX::Types -declare, [qw(Column Constraint Index Procedure Schema Table Trigger 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 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' }; +class_type Trigger, { class => 'SQL::Translator::Object::Trigger' }; +class_type View, { class => 'SQL::Translator::Object::View' }; 1;