diff --git a/lib/NGCP/Schema/Result/voip_cf_destinations.pm b/lib/NGCP/Schema/Result/voip_cf_destinations.pm index 58dd73ff..a1025369 100644 --- a/lib/NGCP/Schema/Result/voip_cf_destinations.pm +++ b/lib/NGCP/Schema/Result/voip_cf_destinations.pm @@ -34,6 +34,13 @@ __PACKAGE__->add_columns( extra => { unsigned => 1 }, is_nullable => 0, }, + "announcement_id", + { + data_type => "integer", + extra => { unsigned => 0 }, + is_foreign_key => 1, + is_nullable => 1, + }, ); __PACKAGE__->set_primary_key("id"); @@ -45,6 +52,13 @@ __PACKAGE__->belongs_to( { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); +__PACKAGE__->belongs_to( + "voip_sound_handles", + "NGCP::Schema::Result::voip_sound_handles", + { id => "announcement_id" }, + { is_deferrable => 1, on_delete => "SET NULL", on_update => "CASCADE" }, +); + sub TO_JSON { my ($self) = @_; return { diff --git a/lib/NGCP/Schema/Result/voip_sound_handles.pm b/lib/NGCP/Schema/Result/voip_sound_handles.pm index e29d3574..09415263 100644 --- a/lib/NGCP/Schema/Result/voip_sound_handles.pm +++ b/lib/NGCP/Schema/Result/voip_sound_handles.pm @@ -37,6 +37,12 @@ __PACKAGE__->has_many( { "foreign.handle_id" => "self.id" }, { cascade_copy => 0, cascade_delete => 0 }, ); +__PACKAGE__->has_many( + "voip_cf_destinations", + "NGCP::Schema::Result::voip_cf_destinations", + { "foreign.announcement_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); sub TO_JSON { my ($self) = @_;