1 package DBIx::Class::DeploymentHandler::VersionStorage::Deprecated;
3 use DBIx::Class::DeploymentHandler::Logger;
4 use Log::Contextual ':log', -package_logger =>
5 DBIx::Class::DeploymentHandler::Logger->new({
10 # ABSTRACT: (DEPRECATED) Use this if you are stuck in the past
13 isa => 'DBIx::Class::Schema',
19 isa => 'DBIx::Class::ResultSet',
21 builder => '_build_version_rs',
22 handles => [qw( database_version version_storage_is_installed )],
25 with 'DBIx::Class::DeploymentHandler::HandlesVersionStorage';
27 use DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResult;
28 sub _build_version_rs {
29 $_[0]->schema->register_class(
30 dbix_class_schema_versions =>
31 'DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResult'
33 $_[0]->schema->resultset('dbix_class_schema_versions')
36 sub add_database_version {
37 # deprecated doesn't support ddl or upgrade_ddl
38 my $version = $_[1]->{version};
39 log_debug { "Adding database version $version" };
40 $_[0]->version_rs->create({ version => $version })
43 sub delete_database_version {
44 my $version = $_[1]->{version};
45 log_debug { "Deleting database version $version" };
46 $_[0]->version_rs->search({ version => $version})->delete
49 __PACKAGE__->meta->make_immutable;
53 # vim: ts=2 sw=2 expandtab
59 I begrudgingly made this module (and other related modules) to keep porting
60 from L<DBIx::Class::Schema::Versioned> relatively simple. I will make changes
61 to ensure that it works with output from L<DBIx::Class::Schema::Versioned> etc,
62 but I will not add any new features to it.
64 Once I hit major version 1 usage of this module will emit a warning.
65 On version 2 it will be removed entirely.
69 Here's how to convert from that crufty old Deprecated VersionStorage to a shiny
70 new Standard VersionStorage:
72 my $s = My::Schema->connect(...);
73 my $dh = DeploymentHandler({
77 $dh->prepare_version_storage_install;
78 $dh->install_version_storage;
80 my @versions = $s->{vschema}->resultset('Table')->search(undef, {
81 order_by => 'installed',
82 })->get_column('version')->all;
84 $dh->version_storage->add_database_vesion({ version => $_ })