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;
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);
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;
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;