relation ends to implement performance-critical joins of the form "sipwise_mam.username = concat(voip_subscriber.username,'@',voip_domain.domain)" are added to provisionin_voip_subscriber, to have proper on-clause operands in place (and prevent "unknown column .. in on clause" error in an elegant way). resultset require to join voip_domain explicitly. Change-Id: I4e20c4232f73c7e4286b96da5ded73455a417131changes/62/15162/3
parent
6dbc911d7f
commit
8d433cd4bb
@ -0,0 +1,62 @@
|
|||||||
|
package NGCP::Schema::Result::sipwise_mam;
|
||||||
|
use Scalar::Util qw(blessed);
|
||||||
|
use parent 'DBIx::Class::Core';
|
||||||
|
|
||||||
|
our $VERSION = '2.007';
|
||||||
|
|
||||||
|
__PACKAGE__->load_components(
|
||||||
|
"InflateColumn::DateTime",
|
||||||
|
"Helper::Row::ToJSON",
|
||||||
|
"+NGCP::Schema::InflateColumn::DateTime::EpochMilli",
|
||||||
|
);
|
||||||
|
|
||||||
|
__PACKAGE__->table("prosody.sipwise_mam");
|
||||||
|
|
||||||
|
__PACKAGE__->add_columns(
|
||||||
|
"id",
|
||||||
|
{
|
||||||
|
data_type => "integer",
|
||||||
|
extra => { unsigned => 1 },
|
||||||
|
is_auto_increment => 1,
|
||||||
|
is_nullable => 0,
|
||||||
|
},
|
||||||
|
"username",
|
||||||
|
{
|
||||||
|
data_type => "varchar",
|
||||||
|
is_nullable => 0,
|
||||||
|
size => 255
|
||||||
|
},
|
||||||
|
"key",
|
||||||
|
{
|
||||||
|
data_type => "binary",
|
||||||
|
is_nullable => 0,
|
||||||
|
size => 16
|
||||||
|
},
|
||||||
|
"stanza",
|
||||||
|
{
|
||||||
|
data_type => "text",
|
||||||
|
is_nullable => 1
|
||||||
|
},
|
||||||
|
"epoch",
|
||||||
|
{
|
||||||
|
data_type => "integer",
|
||||||
|
is_nullable => 0,
|
||||||
|
},
|
||||||
|
"with",
|
||||||
|
{
|
||||||
|
data_type => "varchar",
|
||||||
|
is_nullable => 1,
|
||||||
|
size => 255
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
__PACKAGE__->set_primary_key("id");
|
||||||
|
|
||||||
|
sub TO_JSON {
|
||||||
|
my ($self) = @_;
|
||||||
|
return {
|
||||||
|
map { blessed($_) && $_->isa('DateTime') ? $_->datetime : $_ } %{ $self->next::method }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
Loading…
Reference in new issue