---
name: "DBIx::Class::DeploymentHandler::Dad"
section: "3pm"
platform: "linux"
package: "libdbix-class-deploymenthandler-perl"
version: "0.002234-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/DBIx::Class::DeploymentHandler::Dad"
---

# DBIx::Class::DeploymentHandler::Dad(3pm)

Parent class for DeploymentHandlers

## NAME

DBIx::Class::DeploymentHandler::Dad - Parent class for DeploymentHandlers

## METHODS THAT ARE REQUIRED IN SUBCLASSES

### deploy

See "deploy" in DBIx::Class::DeploymentHandler::HandlesDeploy.

### version\_storage\_is\_installed

See "version\_storage\_is\_installed" in DBIx::Class::DeploymentHandler::HandlesVersionStorage.

### add\_database\_version

See "add\_database\_version" in DBIx::Class::DeploymentHandler::HandlesVersionStorage.

### delete\_database\_version

See "delete\_database\_version" in DBIx::Class::DeploymentHandler::HandlesVersionStorage.

### next\_version\_set

See "next\_version\_set" in DBIx::Class::DeploymentHandler::HandlesVersioning.

### previous\_version\_set

See "previous\_version\_set" in DBIx::Class::DeploymentHandler::HandlesVersioning.

### upgrade\_single\_step

See "upgrade\_single\_step" in DBIx::Class::DeploymentHandler::HandlesDeploy.

### downgrade\_single\_step

See "downgrade\_single\_step" in DBIx::Class::DeploymentHandler::HandlesDeploy.

### txn\_do

See "txn\_do" in DBIx::Class::DeploymentHandler::HandlesDeploy.

## ORTHODOX METHODS

These methods are not actually **required** as things will probably still work if you don't implement them, but if you want your subclass to get along with other subclasses (or more likely, tools made to use another subclass), you should probably implement these too, even if they are no-ops.

### database\_version

see "database\_version" in DBIx::Class::DeploymentHandler::HandlesVersionStorage

### prepare\_deploy

see "prepare\_deploy" in DBIx::Class::DeploymentHandler::HandlesDeploy

### prepare\_resultsource\_install

see "prepare\_resultsource\_install" in DBIx::Class::DeploymentHandler::HandlesDeploy

### install\_resultsource

see "install\_resultsource" in DBIx::Class::DeploymentHandler::HandlesDeploy

### prepare\_upgrade

see "prepare\_upgrade" in DBIx::Class::DeploymentHandler::HandlesDeploy

### prepare\_downgrade

see "prepare\_downgrade" in DBIx::Class::DeploymentHandler::HandlesDeploy

### SUBCLASSING

All of the methods mentioned in "METHODS THAT ARE REQUIRED IN SUBCLASSES" and "ORTHODOX METHODS" can be implemented in any fashion you choose.  In the spirit of code reuse I have used roles to implement them in my two subclasses, DBIx::Class::DeploymentHandler and DBIx::Class::DeploymentHandler::Deprecated, but you are free to implement them entirely in a subclass if you so choose to.

For in-depth documentation on how methods are supposed to work, see the roles DBIx::Class::DeploymentHandler::HandlesDeploy, DBIx::Class::DeploymentHandler::HandlesVersioning, and DBIx::Class::DeploymentHandler::HandlesVersionStorage.

## ATTRIBUTES

### schema

The DBIx::Class::Schema (**required**) that is used to talk to the database and generate the DDL.

### schema\_version

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

### backup\_directory

The directory where backups are stored

### to\_version

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

## METHODS

### install

```
 $dh->install
```

or

```
 $dh->install({ version => 1 })
```

Deploys the requested version into the database  Version defaults to "schema\_version".  Populates `"version_storage"` with `"version"` and `"ddl"`.

**Note**: you typically need to call `"$dh->prepare_deploy"` before you call this method.

**Note**: you cannot install on top of an already installed database

### upgrade

```
 $dh->upgrade
```

Upgrades the database one step at a time till "next\_version\_set" returns `"undef"`.  Each upgrade step will add a `"version"`, `"ddl"`, and `"upgrade_sql"` to the version storage (if `"ddl"` and/or `"upgrade_sql"` are returned from "upgrade\_single\_step".

### downgrade

```
 $dh->downgrade
```

Downgrades the database one step at a time till "previous\_version\_set" returns `"undef"`.  Each downgrade step will delete a `"version"` from the version storage.

### backup

```
 $dh->backup
```

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

## AUTHOR

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

## COPYRIGHT AND LICENSE

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

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