NAME

DBIO::DeploymentHandler - Extensible DBIO deployment

VERSION

version 0.900000

SYNOPSIS

use DBIO::DeploymentHandler;
my $s = My::Schema->connect(...);

my $dh = DBIO::DeploymentHandler->new({
  schema => $s,
  upgrade_hooks => {
    2 => {
      post => sub {
        my ($dh, $info) = @_;
        # backfill new column on the now-current schema
        $dh->schema->resultset('User')->update({ status => 'active' });
      },
    },
  },
});

$dh->prepare_install;   # sets up __VERSION table
$dh->install;           # deploys schema via native driver

# later:
$dh->upgrade;           # one-shot reconcile + run hooks for skipped versions

DESCRIPTION

DBIO::DeploymentHandler provides schema deployment and version management using the native DBIO driver deploy system (no SQL::Translator needed).

The driver computes the diff between live database and current code in one shot, so this handler does not loop over discrete version transitions the way DBIx::Class::DeploymentHandler does. The DDL part of an upgrade is always a single reconcile.

For data migrations that the DDL diff cannot express (column backfills, value normalisation, etc.) upgrade_hooks provides per-version pre and post callbacks that fire around the DDL apply, in ascending version order, for every version step that is being crossed. pre hooks see the old schema, post hooks see the new one.

Schema version is tracked in a __VERSION table.

This is a port of DBIx::Class::DeploymentHandler adapted for DBIO's native driver architecture.

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.