use MooseX::Declare;
role SQL::Translator::Object::Compat {
use MooseX::Types qw(Any ArrayRef Int Str);
- use SQL::Translator::Types qw(Column Constraint Index Table Trigger View);
+ use SQL::Translator::Types qw(Column Constraint Index Procedure Table Trigger View);
use MooseX::MultiMethods;
method drop_column(Column|Str $column, Int :$cascade = 0) { $self->remove_column($column, cascade => $cascade) }
method drop_constraint(Constraint|Str $constraint) { $self->remove_constraint($constraint) }
method drop_index(Index|Str $index) { $self->remove_index($index) }
+ method drop_procedure(Procedure|Str $procedure) { $self->remove_procedure($procedure) }
method drop_table(Table|Str $table, Int :$cascade = 0) { $self->remove_table($table, cascade => $cascade) }
method drop_trigger(Trigger|Str $trigger) { $self->remove_trigger($trigger) }
method drop_view(View|Str $view) { $self->remove_view($view) }
class SQL::Translator::Object::Procedure extends SQL::Translator::Object {
use MooseX::Types::Moose qw(ArrayRef Str);
use MooseX::MultiMethods;
+ use SQL::Translator::Types qw(Schema);
+
+ has 'schema' => (
+ is => 'rw',
+ isa => Schema,
+ weak_ref => 1,
+ );
has 'name' => (
is => 'rw',
multi method parameters(Str $parameter) { $self->add_parameter($parameter) }
multi method parameters(ArrayRef $parameter) { $self->add_parameter($parameter) }
- multi method parameters { wantarray ? @{$self->_parameters} : $self->_parameters }
+ multi method parameters { wantarray ? $self->_parameters : $self->_parameters }
}
$self->$orig($view->name, $view)
}
- around add_procedure(Procedure $procedure does coerce) { $self->$orig($procedure->name, $procedure) }
+ around add_procedure(Procedure $procedure does coerce) {
+ $procedure->schema($self);
+ $self->$orig($procedure->name, $procedure)
+ }
+
around add_trigger(Trigger $trigger does coerce) {
$trigger->schema($self);
$self->$orig($trigger->name, $trigger);;