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