MetaSetup neu generiert
[kivitendo-erp.git] / SL / DB / MetaSetup / Currency.pm
index 705467f..c07ef65 100644 (file)
@@ -6,18 +6,32 @@ use strict;
 
 use base qw(SL::DB::Object);
 
-__PACKAGE__->meta->setup(
-  table   => 'currencies',
+__PACKAGE__->meta->table('currencies');
 
-  columns => [
-    id   => { type => 'serial', not_null => 1 },
-    name => { type => 'text', not_null => 1 },
-  ],
+__PACKAGE__->meta->columns(
+  id   => { type => 'serial', not_null => 1 },
+  name => { type => 'text', not_null => 1 },
+);
+
+__PACKAGE__->meta->primary_key_columns([ 'id' ]);
 
-  primary_key_columns => [ 'id' ],
+__PACKAGE__->meta->unique_keys([ 'name' ]);
 
-  unique_key => [ 'name' ],
+__PACKAGE__->meta->relationships(
+  ap => {
+    class      => 'SL::DB::PurchaseInvoice',
+    column_map => { id => 'currency_id' },
+    type       => 'one to many',
+  },
+
+  ar => {
+    class      => 'SL::DB::Invoice',
+    column_map => { id => 'currency_id' },
+    type       => 'one to many',
+  },
 );
 
+# __PACKAGE__->meta->initialize;
+
 1;
 ;