DBIx::C...ler::Dad(3)

πŸ’– DBIx::Class::DeploymentHandler::Dad πŸ’–

okay so bestie, welcome to the DBIx::C...ler::Dad(3) page from the User Contributed Perl Documentation 🫢 this is the parent class for DeploymentHandlers β€” like, the mom of the whole DeploymentHandler fam, and she has expectations for her kids. no cap.


✨ NAME ✨

DBIx::Class::DeploymentHandler::Dad β€” Parent class for DeploymentHandlers πŸ‘‘


🌸 METHODS THAT ARE REQUIRED IN SUBCLASSES 🌸

these are the non-negotiables, bestie. if your subclass doesn't have these, it's not giving what it needs to give πŸ’…

  • 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 πŸŽ€

ngl these aren't technically required β€” things will probably still work if you don't implement them πŸ™ˆ but listen. if you want your subclass to actually get along with other subclasses (or, like, more realistically, tools built to use a different subclass), you should probably implement these too. even if they're just no-ops. it's giving courtesy. it's giving community. ✨

  • 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 up in "METHODS THAT ARE REQUIRED IN SUBCLASSES" and "ORTHODOX METHODS" can be implemented any fashion you choose. literally whatever vibe you want.

in the spirit of code reuse, the author used roles to implement them in his 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. your code, your rules πŸ’…

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. those are the ✨source of truth✨ bestie, go read them.


🌈 ATTRIBUTES 🌈

  • schema β€” The DBIx::Class::Schema (required, no skipping this one πŸ‘€) 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. do not try it. it's not the vibe.

🌟 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. bye bye version 🫑

🌟 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. fr fr. do not come crying to me, test your backups.

πŸ‘‘ AUTHOR πŸ‘‘

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


This software is copyright (c) 2025 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.


and that's the whole page bestie, periodt πŸ’… this was perl v5.42.0, dated 2026-01-17, and you just read DBIx::C...ler::Dad(3) β€” go forth and deploy responsibly, ily πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from