fix typo
[dbsrgits/DBIx-Class-DeploymentHandler.git] / lib / DBIx / Class / DeploymentHandler / Component.pm
CommitLineData
12fdd461 1package DBIx::Class::DepolymentHandler::Component;
2
3use strict;
4use warnings;
5
099d6ab0 6use Carp 'carp';
7
12fdd461 8sub 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
331;