X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-DeploymentHandler.git;a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FDeploymentHandler%2FVersionStorage%2FDeprecated.pm;h=4bc65380ed55cf2e6d83800d4e74cd9861740ea6;hp=282bf4947a0498037a92d7465959db8f6c3ef476;hb=97aa9a748e07c9e5875d56bd7d6554e481911c5d;hpb=f344dd911ffeda3bc0b3bef6f275d27a2c31e8f9 diff --git a/lib/DBIx/Class/DeploymentHandler/VersionStorage/Deprecated.pm b/lib/DBIx/Class/DeploymentHandler/VersionStorage/Deprecated.pm index 282bf49..4bc6538 100644 --- a/lib/DBIx/Class/DeploymentHandler/VersionStorage/Deprecated.pm +++ b/lib/DBIx/Class/DeploymentHandler/VersionStorage/Deprecated.pm @@ -1,9 +1,12 @@ package DBIx::Class::DeploymentHandler::VersionStorage::Deprecated; + use Moose; -use Method::Signatures::Simple; +use DBIx::Class::DeploymentHandler::LogImporter ':log'; + + +# ABSTRACT: (DEPRECATED) Use this if you are stuck in the past has schema => ( - isa => 'DBIx::Class::Schema', is => 'ro', required => 1, ); @@ -28,17 +31,57 @@ sub _build_version_rs { sub add_database_version { # deprecated doesn't support ddl or upgrade_ddl - $_[0]->version_rs->create({ version => $_[1]->{version} }) + my $version = $_[1]->{version}; + log_debug { "Adding database version $version" }; + $_[0]->version_rs->create({ version => $version }) } sub delete_database_version { - $_[0]->version_rs->search({ version => $_[1]->{version}})->delete + my $version = $_[1]->{version}; + log_debug { "Deleting database version $version" }; + $_[0]->version_rs->search({ version => $version})->delete } __PACKAGE__->meta->make_immutable; 1; +# vim: ts=2 sw=2 expandtab + __END__ -vim: ts=2 sw=2 expandtab +=head1 DEPRECATED + +I begrudgingly made this module (and other related modules) to keep porting +from L relatively simple. I will make changes +to ensure that it works with output from L etc, +but I will not add any new features to it. + +Once I hit major version 1 usage of this module will emit a warning. +On version 2 it will be removed entirely. + +=head1 THIS SUCKS + +Here's how to convert from that crufty old Deprecated VersionStorage to a shiny +new Standard VersionStorage: + + my $s = My::Schema->connect(...); + my $dh = DeploymentHandler({ + schema => $s, + }); + + $dh->prepare_version_storage_install; + $dh->install_version_storage; + + my @versions = $s->{vschema}->resultset('Table')->search(undef, { + order_by => 'installed', + })->get_column('version')->all; + + $dh->version_storage->add_database_vesion({ version => $_ }) + for @versions; + +=head1 SEE ALSO + +This class is an implementation of +L. Pretty much all the +documentation is there.