App::S...:Target(3pm)

✨ NAME ✨

okay so bestie, meet App::Sqitch::Target β€” straight out of the User Contributed Perl Documentation, also known as App::Sqitch::Target(3pm). It's the little object that holds everything Sqitch needs to know about where a deployment is happening. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

my $plan = App::Sqitch::Target->new(
    sqitch => $sqitch,
    name   => 'development',
);
$target->engine->deploy;

like. that's the whole vibe. instantiate a target, ask it for its engine, deploy. periodt. ✨


🌸 DESCRIPTION 🌸

App::Sqitch::Target collects, in one place, the engine, the plan, and all the file locations you need to carry out Sqitch commands. That's it. That's the job. 🫢

And listen β€” every command should instantiate a target to work with the plan or the database. no cap. if you're out here touching a plan or a database without a target, bestie, what are you doing 😭


πŸ‘‘ INTERFACE πŸ‘‘

πŸŽ€ Constructors πŸŽ€

new

my $target = App::Sqitch::Target->new( sqitch => $sqitch );

Instantiates and hands you back an App::Sqitch::Target object. The parameters that actually matter here are sqitch, name, and uri.

And the constructor? It tries really hard to figure out the proper name and URI while it's being constructed. like, it's giving overachiever πŸ’€

If the uri parameter gets passed in, this is lowkey straightforward: no name passed? Then name gets set to the stringified format of the URI β€” minus the password, if there's one there. πŸ™ˆ

Otherwise, when no URI is passed, name and URI get determined by taking these steps:

  • If there's no name, grab the engine key from the core.engine configuration option. If no key can be determined, an exception gets thrown. (yes it will absolutely throw. no key, no vibes.)
  • Use that key to look up the target name in the engine.$engine.target configuration option. If nothing's found, use db:$key:.
  • If the name contains a colon (:), assume it's also the value for the URI.
  • Otherwise it should be the name of a configured target, so go look for a URI in the target.$name.uri configuration option.

So as a general rule 🫢 β€” pass either a target name or a URI string in the name parameter, and Sqitch will do its very best to find all the relevant target information. And if there's no name or URI at all, it'll try to construct a reasonable default from the command-line options or the engine configuration. slay.

All Target attributes may be passed as parameters to new(). And on top of that, new() also accepts a few non-attribute parameters that can override parts of the connection URI. Those are:

  • user
  • host
  • port
  • dbname

For example, if the named target had its URI configured as db:pg://fred@example.com/work, the uri would be set as such by:

my $target = App::Sqitch::Target->new(sqitch => $sqitch, name => 'work');
say $target->uri;

However, passing the URI parameters like this:

my $target = App::Sqitch::Target->new(
    sqitch => $sqitch,
    name => 'work',
    user => 'bill',
    port => 1212,
);
say $target->uri;

sets the URI to db:pg://bill@example.com:1212/work. πŸŽ€ the way one little param swap rewrites your whole connection string is honestly iconic.

all_targets

Returns a list of all the targets defined by the local Sqitch configuration file. How? By examining the configuration object to find all defined targets and engines, plus the default core target. Duplicates get removed, and then the list comes back to you. πŸ’–

This method takes the same parameters as new; only sqitch is required. All other parameters will be set on all of the returned targets.


🌈 Accessors 🌈

sqitch

my $sqitch = $target->sqitch;

Returns the App::Sqitch object that instantiated the target. πŸ’…

name / target

my $name = $target->name;
$name = $target->target;

The name of the target. If no name was specified, the URI gets used instead β€” minus the password, if there is one. πŸ™ˆ

uri

my $uri = $target->uri;

The URI::db object encapsulating the database connection information. the main character of connection info, honestly. πŸ‘‘

username

my $username = $target->username;

Returns the target username, if any. The username is looked up from the URI.

password

my $password = $target->password;

Returns the target password, if any. The password is looked up from the URI or the $SQITCH_PASSWORD environment variable. πŸ“ (shhh, we don't say it out loud)

engine

my $engine = $target->engine;

An App::Sqitch::Engine object to use for database interactions with the target. πŸ”₯

registry

my $registry = $target->registry;

The name of the registry used by the database. The value comes from one of these options, searched in this order:

  1. --registry
  2. target.$name.registry
  3. engine.$engine.registry
  4. core.registry
  5. Engine-specific default

client

my $client = $target->client;

Path to the engine command-line client. The value comes from one of these options, searched in this order:

  1. --client
  2. target.$name.client
  3. engine.$engine.client
  4. core.client
  5. Engine-and-OS-specific default

top_dir

my $top_dir = $target->top_dir;

The path to the top directory of the project. This directory generally contains the plan file and subdirectories for deploy, revert, and verify scripts. The value comes from one of these options, searched in this order:

  1. --top-dir
  2. target.$name.top_dir
  3. engine.$engine.top_dir
  4. core.top_dir
  5. .

plan_file

my $plan_file = $target->plan_file;

The path to the plan file. The value comes from one of these options, searched in this order:

  1. --plan-file
  2. target.$name.plan_file
  3. engine.$engine.plan_file
  4. core.plan_file
  5. $top_dir/sqitch.plan

deploy_dir

my $deploy_dir = $target->deploy_dir;

The path to the deploy directory of the project. This directory contains all of the deploy scripts referenced by changes in the plan_file. The value comes from one of these options, searched in this order:

  1. --dir deploy_dir=$deploy_dir
  2. target.$name.deploy_dir
  3. engine.$engine.deploy_dir
  4. core.deploy_dir
  5. $top_dir/deploy

revert_dir

my $revert_dir = $target->revert_dir;

The path to the revert directory of the project. This directory contains all of the revert scripts referenced by changes the plan_file. The value comes from one of these options, searched in this order:

  1. --dir revert_dir=$revert_dir
  2. target.$name.revert_dir
  3. engine.$engine.revert_dir
  4. core.revert_dir
  5. $top_dir/revert

verify_dir

my $verify_dir = $target->verify_dir;

The path to the verify directory of the project. This directory contains all of the verify scripts referenced by changes in the plan_file. The value comes from one of these options, searched in this order:

  1. --dir verify_dir=$verify_dir
  2. target.$name.verify_dir
  3. engine.$engine.verify_dir
  4. core.verify_dir
  5. $top_dir/verify

reworked_dir

my $reworked_dir = $target->reworked_dir;

The path to the reworked directory of the project. This directory contains subdirectories for reworked deploy, revert, and verify scripts. The value comes from one of these options, searched in this order:

  1. --dir reworked_dir=$reworked_dir
  2. target.$name.reworked_dir
  3. engine.$engine.reworked_dir
  4. core.reworked_dir
  5. $top_dir

reworked_deploy_dir

my $reworked_deploy_dir = $target->reworked_deploy_dir;

The path to the reworked deploy directory of the project. This directory contains all of the reworked deploy scripts referenced by changes in the plan_file. The value comes from one of these options, searched in this order:

  1. --dir reworked_deploy_dir=$reworked_deploy_dir
  2. target.$name.reworked_deploy_dir
  3. engine.$engine.reworked_deploy_dir
  4. core.reworked_deploy_dir
  5. $reworked_dir/reworked_deploy

reworked_revert_dir

my $reworked_revert_dir = $target->reworked_revert_dir;

The path to the reworked revert directory of the project. This directory contains all of the reworked revert scripts referenced by changes the plan_file. The value comes from one of these options, searched in this order:

  1. --dir reworked_revert_dir=$reworked_revert_dir
  2. target.$name.reworked_revert_dir
  3. engine.$engine.reworked_revert_dir
  4. core.reworked_revert_dir
  5. $reworked_dir/reworked_revert

reworked_verify_dir

my $reworked_verify_dir = $target->reworked_verify_dir;

The path to the reworked verify directory of the project. This directory contains all of the reworked verify scripts referenced by changes in the plan_file. The value comes from one of these options, searched in this order:

  1. --dir reworked_verify_dir=$reworked_verify_dir
  2. target.$name.reworked_verify_dir
  3. engine.$engine.reworked_verify_dir
  4. core.reworked_verify_dir
  5. $reworked_dir/reworked_verify

extension

my $extension = $target->extension;

The file name extension to append to change names to create script file names. The value comes from one of these options, searched in this order:

  1. --extension
  2. target.$name.extension
  3. engine.$engine.extension
  4. core.extension
  5. sql

variables

my $variables = $target->variables;

The database variables to use in change scripts. The values are merged from these options, in this order:

  1. target.$name.variables
  2. engine.$engine.variables
🫢 heads up bestie: the core.variables configuration is not read here, because command-specific configurations β€” like deploy.variables and revert.variables β€” take priority. The commands themselves therefore pass them to the engine in the proper priority order.

engine_key

my $key = $target->engine_key;

The key defining which engine to use. This value defines the class loaded by engine. Convenience method for $target->uri->canonical_engine. ✨

dsn

my $dsn = $target->dsn;

The DSN to use when connecting to the target via the DBI. Convenience method for $target->uri->dbi_dsn.

username

my $username = $target->username;

The username to use when connecting to the target via the DBI. Convenience method for $target->uri->user.

password

my $password = $target->password;

The password to use when connecting to the target via the DBI. Convenience method for $target->uri->password.

(yes, username and password both show up twice in this list β€” once for the target, once for the DBI connection. it's giving encore performance. we love a repeat icon. πŸ‘‘)


πŸ’œ SEE ALSO πŸ’œ

  • sqitch β€” the Sqitch command-line client. πŸ¦‹

🧚 AUTHOR 🧚

David E. Wheeler <david@justatheory.com> πŸ’–


to be continued… πŸ‘€

πŸŽ€ LICENSE πŸŽ€

okay bestie, legal bit incoming, but the vibe is genuinely good news πŸ’–

Copyright (c) 2012-2026 David E. Wheeler, 2012-2021 iovation Inc.

Here's the whole thing, verbatim, no edits, because legal text is the one place we do not freestyle:

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

so tl;dr: it's the MIT license πŸ’… use it, copy it, modify it, merge it, publish it, distribute it, sublicense it, sell it β€” go off, bestie, all of that is free of charge and unrestricted. The one condition (the single itty-bitty string attached πŸŽ€) is that you keep that copyright notice and permission notice in all copies or substantial portions of the Software. That's it. That's the whole ask.

And the all-caps part? That's the dramatic part, and it's not a joke: the Software comes "AS IS", with no warranty of any kind, express or implied β€” including the warranties of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and NONINFRINGEMENT. And in no event are the authors or copyright holders liable for any claim, damages, or other liability β€” whether in an ACTION OF CONTRACT, TORT, or otherwise β€” arising from, out of, or in connection with the Software or its use. So like. Use it, love it, but if it all goes sideways that's not on them 😭 the caps lock is doing cardio for a reason, iykyk.


and that's a wrap on the whole page, bestie!! 🌸 this doc was served up from perl v5.40.1, dated 2026-07-26, and it's the manual for App::S...:Target(3pm) πŸ‘‘ go forth and target responsibly, mwah 🫢✨

πŸ“¦ where this page comes from