Change-Id: I7a4f6deed9df0ffb8481c6956b60ef2bd4d7b513changes/07/9107/1
parent
d404f40e7b
commit
49d653ace0
@ -0,0 +1,76 @@
|
||||
package NGCP::Schema::Result::sms_journal;
|
||||
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("provisioning.sms_journal");
|
||||
|
||||
__PACKAGE__->add_columns(
|
||||
"id",
|
||||
{
|
||||
data_type => "integer",
|
||||
extra => { unsigned => 1 },
|
||||
is_auto_increment => 1,
|
||||
is_nullable => 0,
|
||||
},
|
||||
"subscriber_id",
|
||||
{
|
||||
data_type => "integer",
|
||||
default_value => 0,
|
||||
extra => { unsigned => 1 },
|
||||
is_nullable => 0,
|
||||
},
|
||||
# "time",
|
||||
# { data_type => "decimal",
|
||||
# is_nullable => 0,
|
||||
# size => [13, 3],
|
||||
# inflate_datetime => 'epoch_milli'
|
||||
# },
|
||||
"time",
|
||||
{
|
||||
data_type => "timestamp",
|
||||
datetime_undef_if_invalid => 1,
|
||||
default_value => \"current_timestamp",
|
||||
is_nullable => 0,
|
||||
},
|
||||
"direction",
|
||||
{
|
||||
data_type => "enum",
|
||||
extra => { list => ["in", "out" ] },
|
||||
is_nullable => 0,
|
||||
},
|
||||
"caller",
|
||||
{ data_type => "varchar", is_nullable => 0, size => 255 },
|
||||
"callee",
|
||||
{ data_type => "varchar", is_nullable => 0, size => 255 },
|
||||
"text",
|
||||
{ data_type => "text", is_nullable => 0 },
|
||||
"reason",
|
||||
{ data_type => "varchar", is_nullable => 0, size => 255 },
|
||||
"status",
|
||||
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 255 },
|
||||
);
|
||||
__PACKAGE__->belongs_to(
|
||||
"provisioning_voip_subscriber",
|
||||
"NGCP::Schema::Result::provisioning_voip_subscribers",
|
||||
{ 'foreign.id' => 'self.subscriber_id' },
|
||||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
__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