TT#2369 add table sms_journal

Change-Id: I7a4f6deed9df0ffb8481c6956b60ef2bd4d7b513
changes/07/9107/1
Gerhard Jungwirth 9 years ago
parent d404f40e7b
commit 49d653ace0

@ -175,6 +175,13 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many(
"sms_journals",
"NGCP::Schema::Result::sms_journal",
{ 'foreign.subscriber_id' => 'self.id' },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many(
"voip_mail_to_fax_secrets_renew_notify",
"NGCP::Schema::Result::voip_mail_to_fax_secret_renew_notify",
@ -525,6 +532,12 @@ Type: has_many
Related object: L<NGCP::Schema::Result::voip_fax_journal>
=head2 sms_journals
Type: has_many
Related object: L<NGCP::Schema::Result::sms_journal>
=head2 voip_mail_to_fax_preference
Type: might_have

@ -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…
Cancel
Save