NAME

DBIO::DeploymentHandler::Dad - Parent class for DeploymentHandlers

VERSION

version 0.900004

DESCRIPTION

Base class of DBIO::DeploymentHandler: the version-independent attributes and the generic install/upgrade/downgrade/backup flow. The flow methods call methods the subclass supplies -- txn_do, deploy, add_database_version, delete_database_version, version_storage_is_installed, next_version_set, previous_version_set, and for the step loops upgrade_single_step / downgrade_single_step. DBIO::DeploymentHandler overrides upgrade and downgrade and does not use the step loops, and no deploy method shipped with DBIO supplies the two step methods (they are not part of DBIO::DeploymentHandler::HandlesDeploy); the loops stay as a template for a subclass that brings its own, and throw a DBIO::Exception naming the missing step method otherwise.

ATTRIBUTES

schema

The schema to deploy.

backup_directory

Directory handed to the storage's backup by "backup". Optional.

to_version

Target version. Defaults to "schema_version", numified if it is a version object; computed once and cached.

schema_version

The version the code declares. Defaults to $schema->schema_version; computed once and cached.

METHODS

new

my $dh = $class->new({ schema => $schema, %attrs });

Takes a hashref or a flat list and copies every key into the object.

has_backup_directory

True if a "backup_directory" was given.

install

$dh->install;
$dh->install({ version => 2 });

Throws if the version table already exists. Otherwise, inside txn_do, calls deploy and records the version (default "to_version") with the DDL deploy returned.

upgrade

Generic step loop: inside txn_do, for every version set next_version_set returns, calls upgrade_single_step and records the last version of the set. Carps when there was nothing to do. Throws a DBIO::Exception up front when the class has no upgrade_single_step. DBIO::DeploymentHandler replaces this with a single-shot reconcile.

downgrade

Generic step loop: inside txn_do, for every version set previous_version_set returns, calls downgrade_single_step and deletes the first version of the set. Carps when there was nothing to do. Throws a DBIO::Exception up front when the class has no downgrade_single_step. DBIO::DeploymentHandler replaces this with a method that always throws.

backup

Calls $schema->storage->backup($self->backup_directory).

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.