« DeploymentHandler/Logger.pm
↑ Summary
DeploymentHandler/DeployMethod/SQL/Translator/ScriptHelpers.pm »
| 1 | package DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::Component; | ||
| 2 | $DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::Component::VERSION = '0.002233'; | ||
| 3 | # ABSTRACT: (DEPRECATED) Attach this component to your schema to ensure you stay up to date | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | |||
| 8 | use Carp 'carp'; | ||
| 9 | use DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResult; | ||
| 10 | |||
| 11 | sub attach_version_storage { | ||
| 12 | $_[0]->register_class( | ||
| 13 | dbix_class_schema_versions => 'DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::VersionResult' | ||
| 14 | ); | ||
| 15 | } | ||
| 16 | |||
| 17 | sub connection { | ||
| 18 | my $self = shift; | ||
| 19 | $self->next::method(@_); | ||
| 20 | |||
| 21 | $self->attach_version_storage; | ||
| 22 | |||
| 23 | my $args = $_[3] || {}; | ||
| 24 | |||
| 25 | unless ( $args->{ignore_version} || $ENV{DBIC_NO_VERSION_CHECK}) { | ||
| 26 | my $versions = $self->resultset('dbix_class_schema_versions'); | ||
| 27 | |||
| 28 | if (!$versions->version_storage_is_installed) { | ||
| 29 | carp "Your DB is currently unversioned. Please call upgrade on your schema to sync the DB.\n"; | ||
| 30 | } elsif ($versions->database_version ne $self->schema_version) { | ||
| 31 | carp 'Versions out of sync. This is ' . $self->schema_version . | ||
| 32 | ', your database contains version ' . $versions->database_version . ", please call upgrade on your Schema.\n"; | ||
| 33 | } | ||
| 34 | } | ||
| 35 | |||
| 36 | return $self; | ||
| 37 | } | ||
| 38 | |||
| 39 | 1; | ||
| 40 | |||
| 41 | # vim: ts=2 sw=2 expandtab | ||
| 42 | |||
| 43 | __END__ | ||
| 44 | |||
| 45 | =pod | ||
| 46 | |||
| 47 | =head1 NAME | ||
| 48 | |||
| 49 | DBIx::Class::DeploymentHandler::VersionStorage::Deprecated::Component - (DEPRECATED) Attach this component to your schema to ensure you stay up to date | ||
| 50 | |||
| 51 | =head1 DEPRECATED | ||
| 52 | |||
| 53 | This component has been suplanted by | ||
| 54 | L<DBIx::Class::DeploymentHandler::VersionStorage::Standard::Component>. | ||
| 55 | In the next major version (1) we will begin issuing a warning on it's use. | ||
| 56 | In the major version after that (2) we will remove it entirely. | ||
| 57 | |||
| 58 | =head1 AUTHOR | ||
| 59 | |||
| 60 | Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> | ||
| 61 | |||
| 62 | =head1 COPYRIGHT AND LICENSE | ||
| 63 | |||
| 64 | This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt. | ||
| 65 | |||
| 66 | This is free software; you can redistribute it and/or modify it under | ||
| 67 | the same terms as the Perl 5 programming language system itself. | ||
| 68 | |||
| 69 | =cut |