DBIx::C...esDeploy(3)

✨ NAME ✨

DBIx::Class::DeploymentHandler::HandlesDeploy β€” bestie, it's literally the interface for deploy methods πŸ’…

So this is a role/interface thingy in the DBIx::Class::DeploymentHandler universe. It doesn't do the work itself, it just says "hey, whoever implements me has to do these things". Think of it as the vibe contract. 🫢


πŸ‘‘ KNOWN IMPLEMENTATIONS πŸ‘‘

Like, who's actually out here implementing this interface? These cuties:

  • DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator
  • DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::Deprecated

πŸŽ€ METHODS πŸŽ€

Okay so here's every single method in the contract, no skips, no shortcuts, we're doing all of them πŸ’–

🌸 initialize 🌸

$dh->initialize({
  version      => 1,
  storage_type => 'SQLite'
});

Run scripts before deploying to the database. That's the whole thing β€” it's the pregame, not the party. ✨

🌸 prepare_deploy 🌸

$dh->prepare_deploy

Generate the needed data files to install the schema to the database. So it's making the stuff you'll need later, not doing the thing yet. Prep era. πŸ“

🌸 deploy 🌸

$dh->deploy({ version => 1 })

Deploy the schema to the database. Yeah. That's it. This is the main character moment, we're actually putting the schema in the database. πŸ”₯

🌸 prepare_resultsource_install 🌸

$dh->prepare_resultsource_install({
  result_source => $resultset->result_source,
})

Takes a DBIx::Class::ResultSource and generates a single migration file to create the resultsource's table. One source β†’ one file. Simple math bestie. πŸ’œ

🌸 install_resultsource 🌸

$dh->install_resultsource({
  result_source => $resultset->result_source,
  version       => 1,
})

Takes a DBIx::Class::ResultSource and runs a single migration file to deploy the resultsource's table. Notice the difference from the one above: that one generates, this one runs. No cap, they are not the same. πŸ‘‘

🌸 prepare_upgrade 🌸

$dh->prepare_upgrade({
  from_version => 1,
  to_version   => 2,
  version_set  => [1, 2]
});

Takes two versions and a version set. This basically is supposed to generate the needed "SQL" to migrate up from the first version to the second version. The version set uniquely identifies the migration. It's giving glow-up, but for your schema. πŸ¦‹

🌸 prepare_downgrade 🌸

$dh->prepare_downgrade({
  from_version => 2,
  to_version   => 1,
  version_set  => [1, 2]
});

Takes two versions and a version set. This basically is supposed to generate the needed "SQL" to migrate down from the first version to the second version. The version set uniquely identifies the migration and should match its respective upgrade version set. So if your upgrade set was [1, 2], your downgrade set better be [1, 2] too. They're a matched set, they're endgame, don't break them up 😭

🌸 upgrade_single_step 🌸

my ($ddl, $sql) = @{
  $dh->upgrade_single_step({ version_set => $version_set })
||[]}

Call a single upgrade migration. Takes a version set as an argument. Optionally return "[ $ddl, $upgrade_sql ]" where $ddl is the DDL for that version of the schema and $upgrade_sql is the SQL that was run to upgrade the database. One step at a time bestie, we're not sprinting. ✨

🌸 downgrade_single_step 🌸

$dh->downgrade_single_step($version_set);

Call a single downgrade migration. Takes a version set as an argument. Optionally return "[ $ddl, $upgrade_sql ]" where $ddl is the DDL for that version of the schema and $upgrade_sql is the SQL that was run to upgrade the database. Yes it still says $upgrade_sql in the downgrade one β€” that's what the original says, so that's what you get, we don't editorialize around here πŸ’…

🌸 txn_do 🌸

$dh->txn_do(sub { ... })

Wrap the passed coderef in a transaction (if transactions are enabled.) Note the if β€” transactions are not guaranteed to be on, so don't come for me if your coderef runs bare. πŸ™ˆ


πŸ’– 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.


okay that's the whole page, you ate that, go deploy something iconic πŸ‘‘

signing off from the User Contributed Perl Documentation section, running on perl v5.42.0, dated 2026-01-17 β€” mwah, bestie, slay πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from