Commit | Line | Data |
30c3818a |
1 | package DBIx::Class::DeploymentHandler::VersionStorage::Standard::Component; |
12fdd461 |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
099d6ab0 |
6 | use Carp 'carp'; |
30c3818a |
7 | use DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult; |
0fa32e91 |
8 | |
6bbb6ce7 |
9 | sub attach_version_storage { |
10 | $_[0]->register_class( |
30c3818a |
11 | __VERSION => 'DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult' |
0fa32e91 |
12 | ); |
13 | } |
099d6ab0 |
14 | |
12fdd461 |
15 | sub connection { |
16 | my $self = shift; |
17 | $self->next::method(@_); |
18 | |
6bbb6ce7 |
19 | $self->attach_version_storage; |
0fa32e91 |
20 | |
099d6ab0 |
21 | my $args = $_[3] || {}; |
12fdd461 |
22 | |
d94ecdd6 |
23 | unless ( $args->{ignore_version} || $ENV{DBIC_NO_VERSION_CHECK}) { |
24 | my $versions = $self->resultset('__VERSION'); |
25 | |
c37d8797 |
26 | if (!$versions->version_storage_is_installed) { |
d94ecdd6 |
27 | carp "Your DB is currently unversioned. Please call upgrade on your schema to sync the DB.\n"; |
c37d8797 |
28 | } elsif ($versions->database_version ne $self->schema_version) { |
d94ecdd6 |
29 | carp 'Versions out of sync. This is ' . $self->schema_version . |
c37d8797 |
30 | ', your database contains version ' . $versions->database_version . ", please call upgrade on your Schema.\n"; |
d94ecdd6 |
31 | } |
12fdd461 |
32 | } |
6bbb6ce7 |
33 | |
12fdd461 |
34 | return $self; |
35 | } |
36 | |
37 | 1; |