add DBIC controls to prevent cascade on Virtual FKCs

This commit is contained in:
Oliver Gorwits
2013-09-08 21:36:31 +01:00
parent 7dadcadf77
commit e1896242fd
3 changed files with 12 additions and 5 deletions

View File

@@ -119,7 +119,8 @@ __PACKAGE__->has_many( nodes_with_age => 'App::Netdisco::DB::Result::Virtual::No
'foreign.switch' => 'self.ip',
'foreign.port' => 'self.port',
},
{ join_type => 'LEFT' },
{ join_type => 'LEFT',
cascade_copy => 0, cascade_update => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many( active_nodes => 'App::Netdisco::DB::Result::Virtual::ActiveNode',
@@ -127,7 +128,8 @@ __PACKAGE__->has_many( active_nodes => 'App::Netdisco::DB::Result::Virtual::Acti
'foreign.switch' => 'self.ip',
'foreign.port' => 'self.port',
},
{ join_type => 'LEFT' },
{ join_type => 'LEFT',
cascade_copy => 0, cascade_update => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many( active_nodes_with_age => 'App::Netdisco::DB::Result::Virtual::ActiveNodeWithAge',
@@ -135,7 +137,8 @@ __PACKAGE__->has_many( active_nodes_with_age => 'App::Netdisco::DB::Result::Virt
'foreign.switch' => 'self.ip',
'foreign.port' => 'self.port',
},
{ join_type => 'LEFT' },
{ join_type => 'LEFT',
cascade_copy => 0, cascade_update => 0, cascade_delete => 0 },
);
=head2 neighbor_alias
@@ -178,7 +181,8 @@ __PACKAGE__->has_many( port_vlans_tagged => 'App::Netdisco::DB::Result::Virtual:
'foreign.ip' => 'self.ip',
'foreign.port' => 'self.port',
},
{ join_type => 'LEFT' },
{ join_type => 'LEFT',
cascade_copy => 0, cascade_update => 0, cascade_delete => 0 },
);
=head2 tagged_vlans

View File

@@ -55,6 +55,7 @@ Link relationship for C<tagging_ports>, see below.
__PACKAGE__->has_many( port_vlans_tagged => 'App::Netdisco::DB::Result::Virtual::DevicePortVlanTagged',
{ 'foreign.ip' => 'self.ip', 'foreign.vlan' => 'self.vlan' },
{ cascade_copy => 0, cascade_update => 0, cascade_delete => 0 }
);
=head2 port_vlans_native
@@ -65,6 +66,7 @@ Link relationship to support C<native_ports>, see below.
__PACKAGE__->has_many( port_vlans_native => 'App::Netdisco::DB::Result::Virtual::DevicePortVlanNative',
{ 'foreign.ip' => 'self.ip', 'foreign.vlan' => 'self.vlan' },
{ cascade_copy => 0, cascade_update => 0, cascade_delete => 0 }
);
=head2 tagging_ports

View File

@@ -40,7 +40,8 @@ __PACKAGE__->set_primary_key("username");
# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2awpSJkzXP7+8eyT4vGjfw
__PACKAGE__->has_many( roles => 'App::Netdisco::DB::Result::Virtual::UserRole', 'username' );
__PACKAGE__->has_many( roles => 'App::Netdisco::DB::Result::Virtual::UserRole',
'username', { cascade_copy => 0, cascade_update => 0, cascade_delete => 0 } );
# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;