TT#66577 sems_registrations, voip_peer_hosts

* add new columns and a primary key to sems_registrations
* voip_peer_hosts add might_have relation to kamailio.lcr_gw
* update kamailio.subscriber table fields
* change provisioning_voip_subscriber -> kamailio_subscriber relation
  from has_many to has_one

Change-Id: I96e4aa7d68c09146d373e7300a762fd1c7b3f7da
mr10.1
Kirill Solomko 4 years ago
parent a6825d73fa
commit 5cb7bcbe58

@ -312,7 +312,7 @@ __PACKAGE__->belongs_to(
{ cascade_copy => 0, cascade_delete => 0 }, { cascade_copy => 0, cascade_delete => 0 },
); );
__PACKAGE__->has_many( __PACKAGE__->has_one(
"kamailio_subscriber", "kamailio_subscriber",
'NGCP::Schema::Result::subscriber', 'NGCP::Schema::Result::subscriber',
{ 'foreign.uuid' => 'self.uuid' }, { 'foreign.uuid' => 'self.uuid' },

@ -13,10 +13,33 @@ __PACKAGE__->load_components("InflateColumn::DateTime", "Helper::Row::ToJSON");
__PACKAGE__->table("kamailio.sems_registrations"); __PACKAGE__->table("kamailio.sems_registrations");
__PACKAGE__->add_columns( __PACKAGE__->add_columns(
"id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_auto_increment => 1,
is_nullable => 0,
},
"subscriber_id", "subscriber_id",
{ data_type => "integer", is_nullable => 0 }, {
data_type => "integer",
extra => { unsigned => 1 },
is_foreign_key => 1,
is_nullable => 1,
},
"peer_host_id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_foreign_key => 1,
is_nullable => 1,
},
"registration_status", "registration_status",
{ data_type => "tinyint", default_value => 0, is_nullable => 0 }, {
data_type => "tinyint",
default_value => 0,
is_nullable => 0
},
"last_registration", "last_registration",
{ {
data_type => "datetime", data_type => "datetime",
@ -37,7 +60,21 @@ __PACKAGE__->add_columns(
{ data_type => "varchar", is_nullable => 1, size => 512 }, { data_type => "varchar", is_nullable => 1, size => 512 },
); );
__PACKAGE__->set_primary_key("subscriber_id"); __PACKAGE__->belongs_to(
"subscriber",
"NGCP::Schema::Result::subscriber",
{ id => "subscriber_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
__PACKAGE__->belongs_to(
"lcr_gw",
"NGCP::Schema::Result::lcr_gw",
{ id => "peer_host_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
__PACKAGE__->set_primary_key("id");
sub TO_JSON { sub TO_JSON {
my ($self) = @_; my ($self) = @_;

@ -22,18 +22,14 @@ __PACKAGE__->add_columns(
}, },
"username", "username",
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 64 }, { data_type => "varchar", default_value => "", is_nullable => 0, size => 64 },
"domain",
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 64 },
"password", "password",
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 40 }, { data_type => "varchar", default_value => "", is_nullable => 0, size => 40 },
"email_address", "domain",
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 64 }, { data_type => "varchar", default_value => "", is_nullable => 0, size => 64 },
"ha1", "ha1",
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 64 }, { data_type => "varchar", default_value => "", is_nullable => 0, size => 64 },
"ha1b", "ha1b",
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 64 }, { data_type => "varchar", default_value => "", is_nullable => 0, size => 64 },
"rpid",
{ data_type => "varchar", is_nullable => 1, size => 64 },
"uuid", "uuid",
{ data_type => "char", is_nullable => 0, size => 36 }, { data_type => "char", is_nullable => 0, size => 36 },
"timezone", "timezone",

@ -67,6 +67,12 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 }, { cascade_copy => 0, cascade_delete => 0 },
); );
__PACKAGE__->might_have(
"lcr_gw",
"NGCP::Schema::Result::lcr_gw",
{ "foreign.flags" => "self.id" },
);
sub TO_JSON { sub TO_JSON {
my ($self) = @_; my ($self) = @_;
return { return {

Loading…
Cancel
Save