Monorail

 view release on metacpan or  search on metacpan

lib/Monorail/Change/AddField.pm  view on Meta::CPAN

=cut


has table          => (is => 'ro', isa => 'Str',      required => 1);
has name           => (is => 'ro', isa => 'Str',      required => 1);
has type           => (is => 'ro', isa => 'Str',      required => 1);
has is_nullable    => (is => 'ro', isa => 'Bool',     required => 1, default => 1);
has is_primary_key => (is => 'ro', isa => 'Bool',     required => 1, default => 0);
has is_unique      => (is => 'ro', isa => 'Bool',     required => 1, default => 0);
has default_value  => (is => 'ro', isa => 'Any',      required => 0);
has size           => (is => 'ro', isa => 'ArrayRef', required => 0);

__PACKAGE__->meta->make_immutable;


sub as_sql {
    my ($self) = @_;

    my $field = $self->as_sql_translator_field;

    return $self->producer->add_field($field);

lib/Monorail/Change/AlterField.pm  view on Meta::CPAN

        return $change->as_perl
    }
    else {
        return;
    }

=cut


has table => (is => 'ro', isa => 'Str',     required => 1);
has from  => (is => 'ro', isa => 'HashRef', required => 1);
has to    => (is => 'ro', isa => 'HashRef', required => 1);


__PACKAGE__->meta->make_immutable;


sub has_changes {
    my ($self) = @_;

    if ($self->from->{name} ne $self->to->{name}) {
        return 1;

lib/Monorail/Change/AlterView.pm  view on Meta::CPAN

package Monorail::Change::AlterView;
$Monorail::Change::AlterView::VERSION = '0.4';
use Moose;
use SQL::Translator::Schema::View;

with 'Monorail::Role::Change::StandardSQL';

has name   => (is => 'ro', isa => 'Str',           required => 1);
has fields => (is => 'ro', isa => 'ArrayRef[Str]', required => 1);
has sql    => (is => 'ro', isa => 'Str',           required => 1);

__PACKAGE__->meta->make_immutable;

sub as_hashref_keys {
    return qw/name fields sql/;
}

sub as_sql {
    my ($self) = @_;

lib/Monorail/Change/CreateConstraint.pm  view on Meta::CPAN

    $add_const->as_sql;

    $add_const->transform_dbix($dbix)

=cut


has table            => (is => 'ro', isa => 'Str',           required => 1);
has name             => (is => 'ro', isa => 'Str',           required => 1);
has type             => (is => 'ro', isa => 'Str',           required => 1);
has field_names      => (is => 'ro', isa => 'ArrayRef[Str]', required => 1);
has on_delete        => (is => 'ro', isa => 'Str',           required => 0);
has on_update        => (is => 'ro', isa => 'Str',           required => 0);
has match_type       => (is => 'ro', isa => 'Str',           required => 0);
has deferrable       => (is => 'ro', isa => 'Bool',          required => 0);
has reference_table  => (is => 'ro', isa => 'Str',           required => 0);
has reference_fields => (is => 'ro', isa => 'ArrayRef[Str]', required => 0);

__PACKAGE__->meta->make_immutable;


sub as_sql {
    my ($self) = @_;

    my $field = $self->as_sql_translator_constraint;

    return $self->producer->alter_create_constraint($field);

lib/Monorail/Change/CreateIndex.pm  view on Meta::CPAN

    $crt_index->as_sql;

    $crt_index->transform_dbix($dbix)

=cut


has table            => (is => 'ro', isa => 'Str',           required => 1);
has name             => (is => 'ro', isa => 'Str',           required => 1);
has type             => (is => 'ro', isa => 'Str',           required => 1);
has fields           => (is => 'ro', isa => 'ArrayRef[Str]', required => 1);
has options          => (is => 'ro', isa => 'ArrayRef',      required => 0);

__PACKAGE__->meta->make_immutable;


sub as_sql {
    my ($self) = @_;

    return $self->producer->alter_create_index($self->as_sql_translator_index);
}

lib/Monorail/Change/CreateTable.pm  view on Meta::CPAN

$Monorail::Change::CreateTable::VERSION = '0.4';
use Moose;
use Monorail::Change::AddField;
use SQL::Translator::Schema;
use SQL::Translator::Schema::Table;
use SQL::Translator::Schema::Constraint;

with 'Monorail::Role::Change::StandardSQL';

has name   => (is => 'ro', isa => 'Str',                required => 1);
has fields => (is => 'ro', isa => 'ArrayRef[HashRef]',  required => 1);

__PACKAGE__->meta->make_immutable;

sub as_hashref_keys {
    return qw/name fields/;
}

sub as_sql {
    my ($self) = @_;

lib/Monorail/Change/CreateView.pm  view on Meta::CPAN

package Monorail::Change::CreateView;
$Monorail::Change::CreateView::VERSION = '0.4';
use Moose;
use SQL::Translator::Schema::View;

with 'Monorail::Role::Change::StandardSQL';

has name   => (is => 'ro', isa => 'Str',           required => 1);
has fields => (is => 'ro', isa => 'ArrayRef[Str]', required => 1);
has sql    => (is => 'ro', isa => 'Str',           required => 1);

__PACKAGE__->meta->make_immutable;

sub as_hashref_keys {
    return qw/name fields sql/;
}

sub as_sql {
    my ($self) = @_;

lib/Monorail/Change/DropConstraint.pm  view on Meta::CPAN

    $add_const->as_sql;

    $add_const->transform_dbix($dbix)

=cut


has table       => (is => 'ro', isa => 'Str',           required => 1);
has name        => (is => 'ro', isa => 'Str',           required => 1);
has type        => (is => 'ro', isa => 'Str',           required => 1);
has field_names => (is => 'ro', isa => 'ArrayRef[Str]', required => 1);

__PACKAGE__->meta->make_immutable;


sub as_sql {
    my ($self) = @_;

    my $field = $self->as_sql_translator_constraint;

    return $self->producer->alter_drop_constraint($field);



( run in 0.346 second using v1.01-cache-2.11-cpan-5f2e87ce722 )