required => 0
);
+=cut
has 'index' => (
is => 'rw',
isa => Maybe[Int],
required => 1
);
+=cut
has 'remarks' => (
is => 'rw',
required => 0
);
+no Moose;
+__PACKAGE__->meta->make_immutable;
+
1;
required => 1
);
+no Moose;
+__PACKAGE__->meta->make_immutable;
+
1;
exists => 'exists_column',
keys => 'column_ids',
get => 'get_column',
- set => 'set_column',
+# set => 'set_column',
},
- required => 1
+ curries => { set => { add_column => sub { my ($self, $body, $column) = @_; $self->$body($column->name, $column); } } },
+ default => sub { {} },
+ required => 0
);
has 'type' => (
required => 1
);
+no Moose;
+__PACKAGE__->meta->make_immutable;
+
1;
default => sub { SQL::Translator::Object::Schema->new }
);
+no Moose;
+__PACKAGE__->meta->make_immutable;
+
1;
package SQL::Translator::Object::Schema;
use Moose;
-use MooseX::Types::Moose qw(HashRef Str);
+use MooseX::Types::Moose qw(HashRef Maybe Str);
use MooseX::AttributeHelpers;
use SQL::Translator::Types qw(Procedure Table View);
extends 'SQL::Translator::Object';
has 'name' => (
is => 'rw',
- isa => Str,
+ isa => Maybe[Str],
required => 1,
- default => '__DEFAULT__'
+ default => ''
);
has 'tables' => (
exists => 'exists_table',
keys => 'table_ids',
get => 'get_table',
- set => 'set_table',
+# set => 'add_table',
},
+ curries => { set => { add_table => sub { my ($self, $body, $table) = @_; $self->$body($table->name, $table); } } },
+ default => sub { {} },
required => 0
);
exists => 'exists_view',
keys => 'view_ids',
get => 'get_view',
- set => 'set_view',
+# set => 'set_view',
},
+ curries => { set => { add_view => sub { my ($self, $body, $view) = @_; $self->$body($view->name, $view); } } },
+ default => sub { {} },
required => 0
);
get => 'get_procedure',
set => 'set_procedure',
},
+ default => sub { {} },
required => 0
);
+no Moose;
+__PACKAGE__->meta()->make_immutable;
+
1;
exists => 'exists_column',
keys => 'column_ids',
get => 'get_column',
- set => 'set_column',
+# set => 'set_column',
},
+ curries => { set => { add_column => sub { my ($self, $body, $column) = @_; $self->$body($column->name, $column); } } },
+ default => sub { {} },
required => 0
);
exists => 'exists_index',
keys => 'index_ids',
get => 'get_index',
- set => 'set_index',
+# set => 'set_index',
},
+ curries => { set => { add_index => sub { my ($self, $body, $index) = @_; $self->$body($index->name, $index); } } },
+ default => sub { {} },
required => 0
);
get => 'get_constraint',
set => 'set_constraint',
},
+ default => sub { {} },
required => 0
);
+=cut
has 'schema' => (
is => 'rw',
isa => Schema,
required => 0,
default => sub { SQL::Translator::Object::Schema->new }
);
+=cut
+no Moose;
+__PACKAGE__->meta()->make_immutable;
1;
has 'name' => (is => 'ro', isa => Str, required => 1);
+no Moose;
+__PACKAGE__->meta->make_immutable;
+
1;
package SQL::Translator::Object::View;
use Moose;
-use MooseX::Types::Moose qw();
-use SQL::Translator::Types qw();
-extends 'SQL::Translator::Object::Table';
+use MooseX::Types::Moose qw(HashRef Str);
+use MooseX::AttributeHelpers;
+use SQL::Translator::Types qw(Column);
+extends 'SQL::Translator::Object';
+
+has 'name' => (
+ is => 'rw',
+ isa => Str,
+ required => 1
+);
+
+has 'columns' => (
+ metaclass => 'Collection::Hash',
+ is => 'rw',
+ isa => HashRef[Column],
+ provides => {
+ exists => 'exists_column',
+ keys => 'column_ids',
+ get => 'get_column',
+ set => 'set_column',
+ },
+ required => 0
+);
has 'sql' => (
is => 'rw',
required => 1
);
+no Moose;
+__PACKAGE__->meta->make_immutable;
+
1;