has 'default_value' => (
is => 'rw',
- isa => Str,
+ isa => Maybe[Str],
required => 0
);
-has 'trigger' => (
+has 'index' => (
is => 'rw',
- isa => Trigger,
+ isa => Maybe[Int],
+ required => 1
+);
+
+has 'remarks' => (
+ is => 'rw',
+ isa => Maybe[Str],
required => 0
);
-has 'index' => (
+has 'trigger' => (
is => 'rw',
- isa => Int,
- required => 1
+ isa => Trigger,
+ required => 0
);
1;
package SQL::Translator::Object::Constraint;
use Moose;
use MooseX::Types::Moose qw(HashRef Str);
+use MooseX::AttributeHelpers;
use SQL::Translator::Types qw(Column);
extends 'SQL::Translator::Object';
);
has 'columns' => (
+ metaclass => 'Collection::Hash',
is => 'rw',
isa => HashRef[Column],
+ provides => {
+ exists => 'exists_column',
+ keys => 'column_ids',
+ get => 'get_column',
+ set => 'set_column',
+ },
required => 1
);
package SQL::Translator::Object::Index;
use Moose;
use MooseX::Types::Moose qw(HashRef Str);
+use MooseX::AttributeHelpers;
use SQL::Translator::Types qw(Column);
extends 'SQL::Translator::Object';
);
has 'columns' => (
+ metaclass => 'Collection::Hash',
is => 'rw',
isa => HashRef[Column],
+ provides => {
+ exists => 'exists_column',
+ keys => 'column_ids',
+ get => 'get_column',
+ set => 'set_column',
+ },
required => 1
);
package SQL::Translator::Object::Procedure;
use Moose;
use MooseX::Types::Moose qw(HashRef Int Maybe Str);
+use MooseX::AttributeHelpers;
use SQL::Translator::Types qw();
use SQL::Translator::Object::Schema;
extends 'SQL::Translator::Object';
);
has 'parameters' => (
+ metaclass => 'Collection::Hash',
is => 'rw',
isa => Maybe[HashRef[Int|Str]],
+ provides => {
+ exists => 'exists_parameter',
+ keys => 'parameter_ids',
+ get => 'get_parameter',
+ set => 'set_parameter',
+ },
required => 0
);
package SQL::Translator::Object::Schema;
use Moose;
use MooseX::Types::Moose qw(HashRef Str);
+use MooseX::AttributeHelpers;
use SQL::Translator::Types qw(Procedure Table View);
extends 'SQL::Translator::Object';
);
has 'tables' => (
+ metaclass => 'Collection::Hash',
is => 'rw',
isa => HashRef[Table],
+ provides => {
+ exists => 'exists_table',
+ keys => 'table_ids',
+ get => 'get_table',
+ set => 'set_table',
+ },
required => 0
);
has 'views' => (
+ metaclass => 'Collection::Hash',
is => 'rw',
isa => HashRef[View],
+ provides => {
+ exists => 'exists_view',
+ keys => 'view_ids',
+ get => 'get_view',
+ set => 'set_view',
+ },
required => 0
);
has 'procedures' => (
+ metaclass => 'Collection::Hash',
is => 'rw',
isa => HashRef[Procedure],
+ provides => {
+ exists => 'exists_procedure',
+ keys => 'procedure_ids',
+ get => 'get_procedure',
+ set => 'set_procedure',
+ },
required => 0
);
use Moose;
use MooseX::Types::Moose qw(HashRef Str);
use MooseX::AttributeHelpers;
-#use MooseX::Types::Set::Object;
use SQL::Translator::Types qw(Column Constraint Index Schema);
use SQL::Translator::Object::Schema;
extends 'SQL::Translator::Object';
has 'name' => (
- is => 'ro',
+ is => 'rw',
isa => Str,
required => 1
);
metaclass => 'Collection::Hash',
is => 'rw',
isa => HashRef[Column],
- required => 1
+ provides => {
+ exists => 'exists_column',
+ keys => 'column_ids',
+ get => 'get_column',
+ set => 'set_column',
+ },
+ required => 0
);
has 'indexes' => (
metaclass => 'Collection::Hash',
is => 'rw',
isa => HashRef[Index],
+ provides => {
+ exists => 'exists_index',
+ keys => 'index_ids',
+ get => 'get_index',
+ set => 'set_index',
+ },
required => 0
);
metaclass => 'Collection::Hash',
is => 'rw',
isa => HashRef[Constraint],
+ provides => {
+ exists => 'exists_constraint',
+ keys => 'constraint_ids',
+ get => 'get_constraint',
+ set => 'set_constraint',
+ },
required => 0
);
has 'schema' => (
- is => 'ro',
+ is => 'rw',
isa => Schema,
- required => 1,
+ required => 0,
default => sub { SQL::Translator::Object::Schema->new }
);