Skip to content
Snippets Groups Projects
Commit 6a4e0689 authored by Leo Gordon's avatar Leo Gordon
Browse files

start checking Hive SQL schema version (code version against db version) and die on mismatch

parent f63aac58
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,7 @@ use Bio::EnsEMBL::Utils::Argument ('rearrange');
use Bio::EnsEMBL::Hive::URLFactory;
use Bio::EnsEMBL::Hive::DBSQL::DBConnection;
use Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor;
use base ('Bio::EnsEMBL::DBSQL::DBAdaptor');
......@@ -48,12 +49,22 @@ use base ('Bio::EnsEMBL::DBSQL::DBAdaptor');
sub new {
my ($class, @args) = @_;
my ($url) = rearrange(['URL'], @args);
if($url) {
return Bio::EnsEMBL::Hive::URLFactory->fetch($url) || die "Unable to connect to '$url'\n";
} else {
return $class->SUPER::new(@args);
my ($url, $no_sql_schema_version_check) = rearrange(['URL', 'NO_SQL_SCHEMA_VERSION_CHECK'], @args);
my $self = $url
? (Bio::EnsEMBL::Hive::URLFactory->fetch($url) || die "Unable to connect to '$url'\n")
: $class->SUPER::new(@args);
unless($no_sql_schema_version_check) {
my $code_sql_schema_version = Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor->get_code_sql_schema_version();
my $db_sql_schema_version = $self->get_MetaAdaptor->fetch_value_by_key( 'hive_sql_schema_version' );
if($code_sql_schema_version ne $db_sql_schema_version) {
die "SQL schema versions mismatch: code_sql_schema_version='$code_sql_schema_version', db_sql_schema_version='$db_sql_schema_version' ";
}
}
return $self;
}
......
......@@ -369,8 +369,8 @@ sub run {
}
}
my $hive_dba = Bio::EnsEMBL::Hive::DBSQL::DBAdaptor->new( %{$self->o('pipeline_db')} );
Bio::EnsEMBL::Registry->no_version_check(1);
my $hive_dba = Bio::EnsEMBL::Hive::DBSQL::DBAdaptor->new( %{$self->o('pipeline_db')}, -no_sql_schema_version_check => 1 );
my $resource_class_adaptor = $hive_dba->get_ResourceClassAdaptor;
unless($job_topup) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment