Tabelle parts: Fremdschlüssel für Konten - bessere Namen
[kivitendo-erp.git] / SL / DB / MetaSetup / RequirementSpecDependency.pm
index 29f0654..5193bfc 100644 (file)
@@ -4,17 +4,27 @@ package SL::DB::RequirementSpecDependency;
 
 use strict;
 
-use base qw(SL::DB::Object);
+use parent qw(SL::DB::Object);
 
-__PACKAGE__->meta->setup(
-  table   => 'requirement_spec_item_dependencies',
+__PACKAGE__->meta->table('requirement_spec_item_dependencies');
 
-  columns => [
-    depending_item_id => { type => 'integer', not_null => 1 },
-    depended_item_id  => { type => 'integer', not_null => 1 },
-  ],
+__PACKAGE__->meta->columns(
+  depended_item_id  => { type => 'integer', not_null => 1 },
+  depending_item_id => { type => 'integer', not_null => 1 },
+);
+
+__PACKAGE__->meta->primary_key_columns([ 'depending_item_id', 'depended_item_id' ]);
+
+__PACKAGE__->meta->foreign_keys(
+  depended_item => {
+    class       => 'SL::DB::RequirementSpecItem',
+    key_columns => { depended_item_id => 'id' },
+  },
 
-  primary_key_columns => [ 'depending_item_id', 'depended_item_id' ],
+  depending_item => {
+    class       => 'SL::DB::RequirementSpecItem',
+    key_columns => { depending_item_id => 'id' },
+  },
 );
 
 1;