DBIx-Class-DeploymentHandler

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    schema_from_schema_loader from that package.

0.001008  2012-02-19 10:12:34 CST6CDT
  - Added dep on parent, bump dep on DBD::SQLite to avoid silly failures

0.001007  2012-02-16 08:58:30 CST6CDT
  - removed the rest of the references to Method::Signatures::Simple

0.001006  2012-02-01 21:18:38 CST6CDT
  - Fix install to allow you to deploy to a given version (jnap)
  - Fix the backup method to use storage, not schema (jnap)
  - Fix the reasonable defaults for downgrading (jnap)
  - Stop warning all the time (ribasushi)
  - croak on a couple errors that should be fatal
  - Stop deleting the wrong version (for downgrades)
  - Fix documentation for in the Cookbook (moltar)
  - removed Method::Signatures::Simple stuff (dhoss)

0.001005  2011-04-13 15:21:08 CST6CDT
  - Add _any "version" for running code for all versions
  - Fix more minor pod niggles

lib/DBIx/Class/DeploymentHandler/Dad.pm  view on Meta::CPAN

require DBIx::Class::Schema;    # loaded for type constraint
use Carp::Clan '^DBIx::Class::DeploymentHandler';
use DBIx::Class::DeploymentHandler::LogImporter ':log';
use DBIx::Class::DeploymentHandler::Types;

has schema => (
  is       => 'ro',
  required => 1,
);

has backup_directory => (
  isa => 'Str',
  is  => 'ro',
  predicate  => 'has_backup_directory',
);

has to_version => (
  is         => 'ro',
  isa        => 'Str',
  lazy_build => 1,
);

sub _build_to_version {
  my $version = $_[0]->schema_version;

lib/DBIx/Class/DeploymentHandler/Dad.pm  view on Meta::CPAN

       $ran_once = 1;
       $self->downgrade_single_step({ version_set => $version_list });

       # do we just delete a row here?  I think so but not sure
       $self->delete_database_version({ version => $version_list->[0] });
     }
  });
  log_warn { 'no version to run downgrade' } unless $ran_once;
}

sub backup {
  my $self = shift;
  log_info { 'backing up' };
  $self->schema->storage->backup($self->backup_directory)
}

__PACKAGE__->meta->make_immutable;

1;

# vim: ts=2 sw=2 expandtab

__END__

lib/DBIx/Class/DeploymentHandler/Dad.pm  view on Meta::CPAN

=head2 schema

The L<DBIx::Class::Schema> (B<required>) that is used to talk to the database
and generate the DDL.

=head2 schema_version

The version that the schema is currently at.  Defaults to
C<< $self->schema->schema_version >>.

=head2 backup_directory

The directory where backups are stored

=head2 to_version

The version (defaults to schema's version) to migrate the database to

=head1 METHODS

=head2 install

 $dh->install

lib/DBIx/Class/DeploymentHandler/Dad.pm  view on Meta::CPAN

returned from L</upgrade_single_step>.

=head2 downgrade

 $dh->downgrade

Downgrades the database one step at a time till L</previous_version_set>
returns C<undef>.  Each downgrade step will delete a C<version> from the
version storage.

=head2 backup

 $dh->backup

Simply calls backup on the C<< $schema->storage >>, passing in
C<< $self->backup_directory >> as an argument.  Please test yourself before
assuming it will work.

=head1 AUTHOR

Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2024 by Arthur Axel "fREW" Schmidt.



( run in 1.045 second using v1.01-cache-2.11-cpan-49f99fa48dc )