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