1 package DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator;
5 # ABSTRACT: Manage your SQL and Perl migrations in nicely laid out directories
8 use Carp qw( carp croak );
9 use DBIx::Class::DeploymentHandler::LogImporter qw(:log :dlog);
10 use Context::Preserve;
15 require SQL::Translator::Diff;
17 require DBIx::Class::Storage; # loaded for type constraint
18 use DBIx::Class::DeploymentHandler::Types;
20 use Path::Class qw(file dir);
22 with 'DBIx::Class::DeploymentHandler::HandlesDeploy';
30 has force_overwrite => (
42 isa => 'DBIx::Class::Storage',
49 my $s = $self->schema->storage;
50 $s->_determine_driver;
54 has sql_translator_args => (
57 default => sub { {} },
59 has script_directory => (
68 isa => 'DBIx::Class::DeploymentHandler::Databases',
70 default => sub { [qw( MySQL SQLite PostgreSQL )] },
79 has schema_version => (
85 # this will probably never get called as the DBICDH
86 # will be passing down a schema_version normally, which
87 # is built the same way, but we leave this in place
88 sub _build_schema_version {
90 $self->schema->schema_version
93 sub __ddl_consume_with_prefix {
94 my ($self, $type, $versions, $prefix) = @_;
95 my $base_dir = $self->script_directory;
97 my $main = dir( $base_dir, $type );
99 dir( $base_dir, '_common', $prefix, join q(-), @{$versions} );
102 dir( $base_dir, '_common', $prefix, '_any' );
106 $dir = dir($main, $prefix, join q(-), @{$versions})
108 if ($self->ignore_ddl) {
111 croak "$main does not exist; please write/generate some SQL"
114 my $dir_any = dir($main, $prefix, '_any');
118 opendir my($dh), $dir;
120 map { $_ => "$dir/$_" }
121 grep { /\.(?:sql|pl|sql-\w+)$/ && -f "$dir/$_" }
125 die $_ unless $self->ignore_ddl;
127 for my $dirname (grep { -d $_ } $common, $common_any, $dir_any) {
128 opendir my($dh), $dirname;
129 for my $filename (grep { /\.(?:sql|pl)$/ && -f file($dirname,$_) } readdir $dh) {
130 unless ($files{$filename}) {
131 $files{$filename} = file($dirname,$filename);
137 return [@files{sort keys %files}]
140 sub _ddl_initialize_consume_filenames {
141 my ($self, $type, $version) = @_;
142 $self->__ddl_consume_with_prefix($type, [ $version ], 'initialize')
145 sub _ddl_schema_consume_filenames {
146 my ($self, $type, $version) = @_;
147 $self->__ddl_consume_with_prefix($type, [ $version ], 'deploy')
150 sub _ddl_protoschema_deploy_consume_filenames {
151 my ($self, $version) = @_;
152 my $base_dir = $self->script_directory;
154 my $dir = dir( $base_dir, '_source', 'deploy', $version);
155 return [] unless -d $dir;
157 opendir my($dh), $dir;
158 my %files = map { $_ => "$dir/$_" } grep { /\.yml$/ && -f "$dir/$_" } readdir $dh;
161 return [@files{sort keys %files}]
164 sub _ddl_protoschema_upgrade_consume_filenames {
165 my ($self, $versions) = @_;
166 my $base_dir = $self->script_directory;
168 my $dir = dir( $base_dir, '_preprocess_schema', 'upgrade', join q(-), @{$versions});
170 return [] unless -d $dir;
172 opendir my($dh), $dir;
173 my %files = map { $_ => "$dir/$_" } grep { /\.pl$/ && -f "$dir/$_" } readdir $dh;
176 return [@files{sort keys %files}]
179 sub _ddl_protoschema_downgrade_consume_filenames {
180 my ($self, $versions) = @_;
181 my $base_dir = $self->script_directory;
183 my $dir = dir( $base_dir, '_preprocess_schema', 'downgrade', join q(-), @{$versions});
185 return [] unless -d $dir;
187 opendir my($dh), $dir;
188 my %files = map { $_ => "$dir/$_" } grep { /\.pl$/ && -f "$dir/$_" } readdir $dh;
191 return [@files{sort keys %files}]
194 sub _ddl_protoschema_produce_filename {
195 my ($self, $version) = @_;
196 my $dirname = dir( $self->script_directory, '_source', 'deploy', $version );
197 $dirname->mkpath unless -d $dirname;
199 return "" . file( $dirname, '001-auto.yml' );
202 sub _ddl_schema_produce_filename {
203 my ($self, $type, $version) = @_;
204 my $dirname = dir( $self->script_directory, $type, 'deploy', $version );
205 $dirname->mkpath unless -d $dirname;
207 return "" . file( $dirname, '001-auto.sql' );
210 sub _ddl_schema_upgrade_consume_filenames {
211 my ($self, $type, $versions) = @_;
212 $self->__ddl_consume_with_prefix($type, $versions, 'upgrade')
215 sub _ddl_schema_downgrade_consume_filenames {
216 my ($self, $type, $versions) = @_;
217 $self->__ddl_consume_with_prefix($type, $versions, 'downgrade')
220 sub _ddl_schema_upgrade_produce_filename {
221 my ($self, $type, $versions) = @_;
222 my $dir = $self->script_directory;
224 my $dirname = dir( $dir, $type, 'upgrade', join q(-), @{$versions});
225 $dirname->mkpath unless -d $dirname;
227 return "" . file( $dirname, '001-auto.sql' );
230 sub _ddl_schema_downgrade_produce_filename {
231 my ($self, $type, $versions, $dir) = @_;
232 my $dirname = dir( $dir, $type, 'downgrade', join q(-), @{$versions} );
233 $dirname->mkpath unless -d $dirname;
235 return "" . file( $dirname, '001-auto.sql');
239 my ($self, $sql) = @_;
240 my $storage = $self->storage;
242 $sql = [ _split_sql_chunk( @$sql ) ];
244 Dlog_trace { "Running SQL $_" } $sql;
245 foreach my $line (@{$sql}) {
246 $storage->_query_start($line);
247 # the whole reason we do this is so that we can see the line that was run
249 $storage->dbh_do (sub { $_[1]->do($line) });
252 die "$_ (running line '$line')"
254 $storage->_query_end($line);
256 return join "\n", @$sql
259 # split a chunk o' SQL into statements
260 sub _split_sql_chunk {
261 my @sql = map { split /;\n/, $_ } @_;
265 s/^(?:BEGIN|BEGIN TRANSACTION|COMMIT).*//mgi;
281 return grep $_, @sql;
285 my ($self, $filename) = @_;
286 log_debug { "Running SQL from $filename" };
287 return $self->_run_sql_array($self->_read_sql_file($filename));
294 my $_package = $_file;
295 $_package =~ s/([^A-Za-z0-9_])/sprintf("_%2x", ord($1))/eg;
297 my $fn = eval sprintf <<'END_EVAL', $_package;
298 package DBICDH::Sandbox::%s;
301 $app ||= require $_file;
302 if ( !$app && ( my $error = $@ || $! )) { die $error; }
309 croak "$_file should define an anonymous sub that takes a schema but it didn't!"
310 unless ref $fn && ref $fn eq 'CODE';
316 my ($self, $filename, $versions) = @_;
317 log_debug { "Running Perl from $filename" };
319 my $fn = _load_sandbox($filename);
321 Dlog_trace { "Running Perl $_" } $fn;
323 $fn->($self->schema, $versions)
327 my ( $self, $code ) = @_;
328 return $code->() unless $self->txn_wrap;
330 my $guard = $self->schema->txn_scope_guard;
332 return preserve_context { $code->() } after => sub { $guard->commit };
335 sub _run_sql_and_perl {
336 my ($self, $filenames, $sql_to_run, $versions) = @_;
337 my @files = @{$filenames};
339 $self->_run_sql_array($sql_to_run) if $self->ignore_ddl;
341 my $sql = ($sql_to_run)?join ";\n", @$sql_to_run:'';
343 for my $filename (map file($_), @files) {
344 if ($self->ignore_ddl && $filename->basename =~ /^[^-]*-auto.*\.sql$/) {
346 } elsif ($filename =~ /\.sql$/) {
347 $sql .= $self->_run_sql($filename)
348 } elsif ( $filename =~ /\.pl$/ ) {
349 $self->_run_perl($filename, $versions)
351 croak "A file ($filename) got to deploy that wasn't sql or perl!";
361 my $version = (shift @_ || {})->{version} || $self->schema_version;
362 log_info { "deploying version $version" };
363 my $sqlt_type = $self->storage->sqlt_type;
365 my $sqltargs = $self->sql_translator_args;
366 if ($self->ignore_ddl) {
367 $sql = $self->_sql_from_yaml($sqltargs,
368 '_ddl_protoschema_deploy_consume_filenames', $sqlt_type
371 return $self->_run_sql_and_perl($self->_ddl_schema_consume_filenames(
374 ), $sql, [$version]);
380 my $version = $args->{version} || $self->schema_version;
381 log_info { "initializing version $version" };
382 my $storage_type = $args->{storage_type} || $self->storage->sqlt_type;
384 my @files = @{$self->_ddl_initialize_consume_filenames(
389 for my $filename (@files) {
390 # We ignore sql for now (till I figure out what to do with it)
391 if ( $filename =~ /^(.+)\.pl$/ ) {
392 my $filedata = do { local( @ARGV, $/ ) = $filename; <> };
394 no warnings 'redefine';
395 my $fn = eval "$filedata";
399 croak "$filename failed to compile: $@";
400 } elsif (ref $fn eq 'CODE') {
403 croak "$filename should define an anonymous sub but it didn't!";
406 croak "A file ($filename) got to initialize_scripts that wasn't sql or perl!";
411 sub _sqldiff_from_yaml {
412 my ($self, $from_version, $to_version, $db, $direction) = @_;
413 my $dir = $self->script_directory;
416 ignore_constraint_names => 1,
417 ignore_index_names => 1,
418 %{$self->sql_translator_args}
423 my $prefilename = $self->_ddl_protoschema_produce_filename($from_version, $dir);
425 # should probably be a croak
426 carp("No previous schema file found ($prefilename)")
427 unless -e $prefilename;
429 my $t = SQL::Translator->new({
433 parser => 'SQL::Translator::Parser::YAML',
436 my $out = $t->translate( $prefilename )
439 $source_schema = $t->schema;
441 $source_schema->name( $prefilename )
442 unless $source_schema->name;
447 my $filename = $self->_ddl_protoschema_produce_filename($to_version, $dir);
449 # should probably be a croak
450 carp("No next schema file found ($filename)")
453 my $t = SQL::Translator->new({
457 parser => 'SQL::Translator::Parser::YAML',
460 my $out = $t->translate( $filename )
463 $dest_schema = $t->schema;
465 $dest_schema->name( $filename )
466 unless $dest_schema->name;
469 my $transform_files_method = "_ddl_protoschema_${direction}_consume_filenames";
470 my $transforms = $self->_coderefs_per_files(
471 $self->$transform_files_method([$from_version, $to_version])
473 $_->($source_schema, $dest_schema) for @$transforms;
475 return [SQL::Translator::Diff::schema_diff(
483 my ($self, $sqltargs, $from_file, $db) = @_;
484 my $schema = $self->schema;
485 my $version = $self->schema_version;
489 my $actual_file = $self->$from_file($version);
490 for my $yaml_filename (@{(
491 DlogS_trace { "generating SQL from Serialized SQL Files: $_" }
492 (ref $actual_file?$actual_file:[$actual_file])
494 my $sqlt = SQL::Translator->new({
496 parser => 'SQL::Translator::Parser::YAML',
501 push @sql, $sqlt->translate($yaml_filename);
503 carp("Failed to translate to $db, skipping. (" . $sqlt->error . ")");
510 sub _prepare_install {
512 my $sqltargs = { %{$self->sql_translator_args}, %{shift @_} };
513 my $from_file = shift;
515 my $dir = $self->script_directory;
516 my $databases = $self->databases;
517 my $version = $self->schema_version;
519 foreach my $db (@$databases) {
520 my $sql = $self->_sql_from_yaml($sqltargs, $from_file, $db ) or next;
522 my $filename = $self->$to_file($db, $version, $dir);
524 if ($self->force_overwrite) {
525 carp "Overwriting existing DDL file - $filename";
528 die "Cannot overwrite '$filename', either enable force_overwrite or delete it"
531 open my $file, q(>), $filename;
532 print {$file} join ";\n", @$sql, '';
537 sub _resultsource_install_filename {
538 my ($self, $source_name) = @_;
540 my ($self, $type, $version) = @_;
541 my $dirname = dir( $self->script_directory, $type, 'deploy', $version );
542 $dirname->mkpath unless -d $dirname;
544 return "" . file( $dirname, "001-auto-$source_name.sql" );
548 sub _resultsource_protoschema_filename {
549 my ($self, $source_name) = @_;
551 my ($self, $version) = @_;
552 my $dirname = dir( $self->script_directory, '_source', 'deploy', $version );
553 $dirname->mkpath unless -d $dirname;
555 return "" . file( $dirname, "001-auto-$source_name.yml" );
559 sub install_resultsource {
560 my ($self, $args) = @_;
561 my $source = $args->{result_source}
562 or die 'result_source must be passed to install_resultsource';
563 my $version = $args->{version}
564 or die 'version must be passed to install_resultsource';
565 log_info { 'installing_resultsource ' . $source->source_name . ", version $version" };
566 my $rs_install_file =
567 $self->_resultsource_install_filename($source->source_name);
570 $self->$rs_install_file(
571 $self->storage->sqlt_type,
575 $self->_run_sql_and_perl($files, '', [$version]);
578 sub prepare_resultsource_install {
580 my $source = (shift @_)->{result_source};
581 log_info { 'preparing install for resultsource ' . $source->source_name };
583 my $install_filename = $self->_resultsource_install_filename($source->source_name);
584 my $proto_filename = $self->_resultsource_protoschema_filename($source->source_name);
585 $self->prepare_protoschema({
586 parser_args => { sources => [$source->source_name], }
588 $self->_prepare_install({}, $proto_filename, $install_filename);
592 log_info { 'preparing deploy' };
594 $self->prepare_protoschema({
595 # Exclude __VERSION so that it gets installed separately
599 grep { $_ ne '__VERSION' }
600 $self->schema->sources
603 }, '_ddl_protoschema_produce_filename');
604 $self->_prepare_install({}, '_ddl_protoschema_produce_filename', '_ddl_schema_produce_filename');
607 sub prepare_upgrade {
608 my ($self, $args) = @_;
610 "preparing upgrade from $args->{from_version} to $args->{to_version}"
612 $self->_prepare_changegrade(
613 $args->{from_version}, $args->{to_version}, $args->{version_set}, 'upgrade'
617 sub prepare_downgrade {
618 my ($self, $args) = @_;
620 "preparing downgrade from $args->{from_version} to $args->{to_version}"
622 $self->_prepare_changegrade(
623 $args->{from_version}, $args->{to_version}, $args->{version_set}, 'downgrade'
627 sub _coderefs_per_files {
628 my ($self, $files) = @_;
629 no warnings 'redefine';
630 [map eval do { local( @ARGV, $/ ) = $_; <> }, @$files]
633 sub _prepare_changegrade {
634 my ($self, $from_version, $to_version, $version_set, $direction) = @_;
635 my $schema = $self->schema;
636 my $databases = $self->databases;
637 my $dir = $self->script_directory;
639 my $schema_version = $self->schema_version;
640 my $diff_file_method = "_ddl_schema_${direction}_produce_filename";
641 foreach my $db (@$databases) {
642 my $diff_file = $self->$diff_file_method($db, $version_set, $dir );
644 if ($self->force_overwrite) {
645 carp("Overwriting existing $direction-diff file - $diff_file");
648 die "Cannot overwrite '$diff_file', either enable force_overwrite or delete it"
652 open my $file, q(>), $diff_file;
653 print {$file} join ";\n", @{$self->_sqldiff_from_yaml($from_version, $to_version, $db, $direction)};
659 my ($self, $file) = @_;
662 local $/ = undef; #sluuuuuurp
664 open my $fh, '<', $file;
665 return [ _split_sql_chunk( <$fh> ) ];
668 sub downgrade_single_step {
670 my $version_set = (shift @_)->{version_set};
671 Dlog_info { "downgrade_single_step'ing $_" } $version_set;
673 my $sqlt_type = $self->storage->sqlt_type;
675 if ($self->ignore_ddl) {
676 $sql_to_run = $self->_sqldiff_from_yaml(
677 $version_set->[0], $version_set->[1], $sqlt_type, 'downgrade',
680 my $sql = $self->_run_sql_and_perl($self->_ddl_schema_downgrade_consume_filenames(
683 ), $sql_to_run, $version_set);
688 sub upgrade_single_step {
690 my $version_set = (shift @_)->{version_set};
691 Dlog_info { "upgrade_single_step'ing $_" } $version_set;
693 my $sqlt_type = $self->storage->sqlt_type;
695 if ($self->ignore_ddl) {
696 $sql_to_run = $self->_sqldiff_from_yaml(
697 $version_set->[0], $version_set->[1], $sqlt_type, 'upgrade',
700 my $sql = $self->_run_sql_and_perl($self->_ddl_schema_upgrade_consume_filenames(
703 ), $sql_to_run, $version_set);
707 sub prepare_protoschema {
709 my $sqltargs = { %{$self->sql_translator_args}, %{shift @_} };
712 = $self->$to_file($self->schema_version);
714 # we do this because the code that uses this sets parser args,
715 # so we just need to merge in the package
716 my $sqlt = SQL::Translator->new({
717 parser => 'SQL::Translator::Parser::DBIx::Class',
718 producer => 'SQL::Translator::Producer::YAML',
722 my $yml = $sqlt->translate(data => $self->schema);
724 croak("Failed to translate to YAML: " . $sqlt->error)
728 if ($self->force_overwrite) {
729 carp "Overwriting existing DDL-YML file - $filename";
732 die "Cannot overwrite '$filename', either enable force_overwrite or delete it"
736 open my $file, q(>), $filename;
741 __PACKAGE__->meta->make_immutable;
745 # vim: ts=2 sw=2 expandtab
751 This class is the meat of L<DBIx::Class::DeploymentHandler>. It takes care
752 of generating serialized schemata as well as sql files to move from one
753 version of a schema to the rest. One of the hallmark features of this class
754 is that it allows for multiple sql files for deploy and upgrade, allowing
755 developers to fine tune deployment. In addition it also allows for perl
756 files to be run at any stage of the process.
758 For basic usage see L<DBIx::Class::DeploymentHandler::HandlesDeploy>. What's
759 documented here is extra fun stuff or private methods.
761 =head1 DIRECTORY LAYOUT
763 Arguably this is the best feature of L<DBIx::Class::DeploymentHandler>.
764 It's spiritually based upon L<DBIx::Migration::Directories>, but has a
765 lot of extensions and modifications, so even if you are familiar with it,
766 please read this. I feel like the best way to describe the layout is with
767 the following example:
793 | | `- 002-remove-customers.pl
796 | | `- 002-generate-customers.pl
798 | `- 999-bump-action.pl
805 | |- 001-create_database.pl
806 | `- 002-create_users_and_permissions.pl
814 So basically, the code
818 on an C<SQLite> database that would simply run
819 C<$sql_migration_dir/SQLite/deploy/1/001-auto.sql>. Next,
821 $dm->upgrade_single_step([1,2])
823 would run C<$sql_migration_dir/SQLite/upgrade/1-2/001-auto.sql> followed by
824 C<$sql_migration_dir/_common/upgrade/1-2/002-generate-customers.pl>, and
825 finally punctuated by
826 C<$sql_migration_dir/_common/upgrade/_any/999-bump-action.pl>.
828 C<.pl> files don't have to be in the C<_common> directory, but most of the time
829 they should be, because perl scripts are generally database independent.
831 Note that unlike most steps in the process, C<initialize> will not run SQL, as
832 there may not even be an database at initialize time. It will run perl scripts
833 just like the other steps in the process, but nothing is passed to them.
834 Until people have used this more it will remain freeform, but a recommended use
835 of initialize is to have it prompt for username and password, and then call the
836 appropriate C<< CREATE DATABASE >> commands etc.
838 =head2 Directory Specification
840 The following subdirectories are recognized by this DeployMethod:
844 =item C<_source> This directory can contain the following directories:
848 =item C<deploy> This directory merely contains directories named after schema
849 versions, which in turn contain C<yaml> files that are serialized versions
850 of the schema at that version. These files are not for editing by hand.
854 =item C<_preprocess_schema> This directory can contain the following
859 =item C<downgrade> This directory merely contains directories named after
860 migrations, which are of the form C<$from_version-$to_version>. Inside of
861 these directories you may put Perl scripts which are to return a subref
862 that takes the arguments C<< $from_schema, $to_schema >>, which are
863 L<SQL::Translator::Schema> objects.
865 =item C<upgrade> This directory merely contains directories named after
866 migrations, which are of the form C<$from_version-$to_version>. Inside of
867 these directories you may put Perl scripts which are to return a subref
868 that takes the arguments C<< $from_schema, $to_schema >>, which are
869 L<SQL::Translator::Schema> objects.
873 =item C<$storage_type> This is a set of scripts that gets run depending on what
874 your storage type is. If you are not sure what your storage type is, take a
875 look at the producers listed for L<SQL::Translator>. Also note, C<_common>
876 is a special case. C<_common> will get merged into whatever other files you
877 already have. This directory can contain the following directories itself:
881 =item C<initialize> Gets run before the C<deploy> is C<deploy>ed. Has the
882 same structure as the C<deploy> subdirectory as well; that is, it has a
883 directory for each schema version. Unlike C<deploy>, C<upgrade>, and C<downgrade>
884 though, it can only run C<.pl> files, and the coderef in the perl files get
885 no arguments passed to them.
887 =item C<deploy> Gets run when the schema is C<deploy>ed. Structure is a
888 directory per schema version, and then files are merged with C<_common> and run
889 in filename order. C<.sql> files are merely run, as expected. C<.pl> files are
890 run according to L</PERL SCRIPTS>.
892 =item C<upgrade> Gets run when the schema is C<upgrade>d. Structure is a directory
893 per upgrade step, (for example, C<1-2> for upgrading from version 1 to version
894 2,) and then files are merged with C<_common> and run in filename order.
895 C<.sql> files are merely run, as expected. C<.pl> files are run according
898 =item C<downgrade> Gets run when the schema is C<downgrade>d. Structure is a directory
899 per downgrade step, (for example, C<2-1> for downgrading from version 2 to version
900 1,) and then files are merged with C<_common> and run in filename order.
901 C<.sql> files are merely run, as expected. C<.pl> files are run according
909 Note that there can be an C<_any> in the place of any of the versions (like
910 C<1-2> or C<1>), which means those scripts will be run B<every> time. So if
911 you have an C<_any> in C<_common/upgrade>, that script will get run for every
916 A perl script for this tool is very simple. It merely needs to contain an
917 anonymous sub that takes a L<DBIx::Class::Schema> and the version set as it's
920 A very basic perl script might look like:
927 use DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::ScriptHelpers
928 'schema_from_schema_loader';
930 schema_from_schema_loader({ naming => 'v4' }, sub {
933 # [1] for deploy, [1,2] for upgrade or downgrade, probably used with _any
934 my $versions = shift;
936 $schema->resultset('Users')->create({
942 Note that the above uses
943 L<DBIx::Class::DeploymentHanlder::DeployMethod::SQL::Translator::ScriptHelpers/schema_from_schema_loader>.
944 Using a raw coderef is strongly discouraged as it is likely to break as you
949 This attribute will, when set to true (default is false), cause the DM to use
950 L<SQL::Translator> to use the C<_source>'s serialized SQL::Translator::Schema
951 instead of any pregenerated SQL. If you have a development server this is
952 probably the best plan of action as you will not be putting as many generated
953 files in your version control. Goes well with with C<databases> of C<[]>.
955 =attr force_overwrite
957 When this attribute is true generated files will be overwritten when the
958 methods which create such files are run again. The default is false, in which
959 case the program will die with a message saying which file needs to be deleted.
963 The L<DBIx::Class::Schema> (B<required>) that is used to talk to the database
964 and generate the DDL.
968 The L<DBIx::Class::Storage> that is I<actually> used to talk to the database
969 and generate the DDL. This is automatically created with L</_build_storage>.
971 =attr sql_translator_args
973 The arguments that get passed to L<SQL::Translator> when it's used.
975 =attr script_directory
977 The directory (default C<'sql'>) that scripts are stored in
981 The types of databases (default C<< [qw( MySQL SQLite PostgreSQL )] >>) to
986 Set to true (which is the default) to wrap all upgrades and deploys in a single
991 The version the schema on your harddrive is at. Defaults to
992 C<< $self->schema->schema_version >>.
996 This class is an implementation of
997 L<DBIx::Class::DeploymentHandler::HandlesDeploy>. Pretty much all the
998 documentation is there.