From 910bec1ffe15812ce7983a6a738d8738ce2918be Mon Sep 17 00:00:00 2001 From: Gerhard Jungwirth Date: Thu, 23 Nov 2017 14:56:55 +0100 Subject: [PATCH] TT#25453 create BareSchema for small schemas with a flexible, on-demand option to define the Result classes which are needed Change-Id: Iec526a08c5dbdedb992acd0bcbf3c7676b9d1d3d --- lib/NGCP/{FaxSchema.pm => BareSchema.pm} | 39 +++++++++++++----------- 1 file changed, 21 insertions(+), 18 deletions(-) rename lib/NGCP/{FaxSchema.pm => BareSchema.pm} (78%) diff --git a/lib/NGCP/FaxSchema.pm b/lib/NGCP/BareSchema.pm similarity index 78% rename from lib/NGCP/FaxSchema.pm rename to lib/NGCP/BareSchema.pm index 5ee5a7f6..7b022518 100644 --- a/lib/NGCP/FaxSchema.pm +++ b/lib/NGCP/BareSchema.pm @@ -1,4 +1,4 @@ -package NGCP::FaxSchema; +package NGCP::BareSchema; use warnings; use strict; @@ -12,23 +12,26 @@ our $VERSION = '2.007'; # warning: NGCP::Schema::ResultSet is not loaded. Therefore the features Helper::ResultSet::IgnoreWantarray # and Helper::ResultSet::SetOperations are not available here. -__PACKAGE__->load_classes( - { 'NGCP::Schema::Result' => [qw/ - provisioning_voip_subscribers - voip_dbaliases - voip_domains - voip_fax_data - voip_fax_destinations - voip_fax_journal - voip_fax_preferences - voip_mail_to_fax_acl - voip_mail_to_fax_preferences - voip_mail_to_fax_secret_renew_notify - voip_subscriber_timezone - voip_subscribers - /] }, - #default_resultset_class => 'ResultSet', -); +sub import { + my ($self, %config) = @_; + my $classes = $config{classes} // []; + + __PACKAGE__->load_classes( { 'NGCP::Schema::Result' => $classes } ); + + # provisioning_voip_subscribers + # voip_dbaliases + # voip_domains + # voip_fax_data + # voip_fax_destinations + # voip_fax_journal + # voip_fax_preferences + # voip_mail_to_fax_acl + # voip_mail_to_fax_preferences + # voip_mail_to_fax_secret_renew_notify + # voip_subscriber_timezone + # voip_subscribers + return; +} # use DBIx::Class::Storage::DBI; # DBIx::Class::Storage::DBI->datetime_parser_type('NGCP::Schema::Storage::DateTime::Format::MySQL');