1 package DBIx::Class::DeploymentHandler::VersionStorage::Deprecated;
3 use DBIx::Class::DeploymentHandler::Logger;
4 use Log::Contextual ':log', -default_logger =>
5 DBIx::Class::DeploymentHandler::Logger->new({
10 # ABSTRACT: (DEPRECATED) Use this if you are stuck in the past
12 use Method::Signatures::Simple;
15 isa => 'DBIx::Class::Schema',
21 isa => 'DBIx::Class::ResultSet',
23 builder => '_build_version_rs',
24 handles => [qw( database_version version_storage_is_installed )],
27 with 'DBIx::Class::DeploymentHandler::HandlesVersionStorage';
29 use DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResult;
30 sub _build_version_rs {
31 $_[0]->schema->register_class(
32 dbix_class_schema_versions =>
33 'DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResult'
35 $_[0]->schema->resultset('dbix_class_schema_versions')
38 sub add_database_version {
39 # deprecated doesn't support ddl or upgrade_ddl
40 my $version = $_[1]->{version};
41 log_debug { "Adding database version $version" };
42 $_[0]->version_rs->create({ version => $version })
45 sub delete_database_version {
46 my $version = $_[1]->{version};
47 log_debug { "Deleting database version $version" };
48 $_[0]->version_rs->search({ version => $version})->delete
51 __PACKAGE__->meta->make_immutable;
55 # vim: ts=2 sw=2 expandtab
61 I begrudgingly made this module (and other related modules) to keep porting
62 from L<DBIx::Class::Schema::Versioned> relatively simple. I will make changes
63 to ensure that it works with output from L<DBIx::Class::Schema::Versioned> etc,
64 but I will not add any new features to it.
66 Once I hit major version 1 usage of this module will emit a warning.
67 On version 2 it will be removed entirely.
71 Here's how to convert from that crufty old Deprecated VersionStorage to a shiny
72 new Standard VersionStorage:
74 my $s = My::Schema->connect(...);
75 my $dh = DeploymentHandler({
79 $dh->prepare_version_storage_install;
80 $dh->install_version_storage;
82 my @versions = $s->{vschema}->resultset('Table')->search(undef, {
83 order_by => 'installed',
84 })->get_column('version')->all;
86 $dh->version_storage->add_database_vesion({ version => $_ })