From 27f3ff5b275efccc6b9b8cb209ffa40fa833420c Mon Sep 17 00:00:00 2001 From: Andreas Granig Date: Wed, 16 Dec 2015 17:17:21 +0100 Subject: [PATCH] MT#16985 Add CentralSchema for interceptions. Change-Id: I55e90dbe363d15837efc73bb0d70c0f2c05ef845 --- lib/NGCP/CentralSchema.pm | 13 +++++++++++++ lib/NGCP/Schema.pm | 7 +++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 lib/NGCP/CentralSchema.pm diff --git a/lib/NGCP/CentralSchema.pm b/lib/NGCP/CentralSchema.pm new file mode 100644 index 00000000..5a310d89 --- /dev/null +++ b/lib/NGCP/CentralSchema.pm @@ -0,0 +1,13 @@ +package NGCP::CentralSchema; +use Moose; +extends 'NGCP::Schema'; + +our $VERSION = '2.007'; + +sub connection { + my ($self) = @_; + $self->SUPER::connection($self->config->as_hash->{ngcp_central_connect_info}); +} + +no Moose; +1; diff --git a/lib/NGCP/Schema.pm b/lib/NGCP/Schema.pm index 48a02aa0..8cc8661d 100644 --- a/lib/NGCP/Schema.pm +++ b/lib/NGCP/Schema.pm @@ -19,8 +19,11 @@ class_has('config', is => 'rw', isa => 'NGCP::Schema::Config', lazy => 1, defaul }); sub connection { - my ($self) = @_; - $self->SUPER::connection($self->config->as_hash->{ngcp_connect_info}); + my ($self, $cfg) = @_; + unless(defined $cfg->{dsn}) { + $cfg = $self->config->as_hash->{ngcp_connect_info}; + } + $self->SUPER::connection($cfg); } sub validate {