MetaSetup neu generiert
[kivitendo-erp.git] / SL / DB / MetaSetup / Part.pm
index bdc726e..d56c037 100644 (file)
@@ -6,93 +6,79 @@ use strict;
 
 use base qw(SL::DB::Object);
 
-__PACKAGE__->meta->setup(
-  table   => 'parts',
+__PACKAGE__->meta->table('parts');
 
-  columns => [
-    id                 => { type => 'integer', not_null => 1, sequence => 'id' },
-    partnumber         => { type => 'text', not_null => 1 },
-    description        => { type => 'text' },
-    listprice          => { type => 'numeric', precision => 5, scale => 15 },
-    sellprice          => { type => 'numeric', precision => 5, scale => 15 },
-    lastcost           => { type => 'numeric', precision => 5, scale => 15 },
-    priceupdate        => { type => 'date', default => 'now' },
-    weight             => { type => 'float', precision => 4 },
-    notes              => { type => 'text' },
-    makemodel          => { type => 'boolean', default => 'false' },
-    assembly           => { type => 'boolean', default => 'false' },
-    alternate          => { type => 'boolean', default => 'false' },
-    rop                => { type => 'float', precision => 4 },
-    inventory_accno_id => { type => 'integer' },
-    income_accno_id    => { type => 'integer' },
-    expense_accno_id   => { type => 'integer' },
-    shop               => { type => 'boolean', default => 'false' },
-    obsolete           => { type => 'boolean', default => 'false' },
-    bom                => { type => 'boolean', default => 'false' },
-    image              => { type => 'text' },
-    drawing            => { type => 'text' },
-    microfiche         => { type => 'text' },
-    partsgroup_id      => { type => 'integer' },
-    ve                 => { type => 'integer' },
-    gv                 => { type => 'numeric', precision => 5, scale => 15 },
-    itime              => { type => 'timestamp', default => 'now()' },
-    mtime              => { type => 'timestamp' },
-    unit               => { type => 'varchar', length => 20, not_null => 1 },
-    formel             => { type => 'text' },
-    not_discountable   => { type => 'boolean', default => 'false' },
-    buchungsgruppen_id => { type => 'integer' },
-    payment_id         => { type => 'integer' },
-    ean                => { type => 'text' },
-    price_factor_id    => { type => 'integer' },
-    onhand             => { type => 'numeric', default => '0', precision => 5, scale => 25 },
-    stockable          => { type => 'boolean', default => 'false' },
-    has_sernumber      => { type => 'boolean', default => 'false' },
-    warehouse_id       => { type => 'integer' },
-    bin_id             => { type => 'integer' },
-  ],
-
-  primary_key_columns => [ 'id' ],
-
-  allow_inline_column_values => 1,
-  unique_key => [ 'partnumber' ],
+__PACKAGE__->meta->columns(
+  id                 => { type => 'integer', not_null => 1, sequence => 'id' },
+  partnumber         => { type => 'text', not_null => 1 },
+  description        => { type => 'text' },
+  listprice          => { type => 'numeric', precision => 5, scale => 15 },
+  sellprice          => { type => 'numeric', precision => 5, scale => 15 },
+  lastcost           => { type => 'numeric', precision => 5, scale => 15 },
+  priceupdate        => { type => 'date', default => 'now' },
+  weight             => { type => 'float', precision => 4 },
+  notes              => { type => 'text' },
+  makemodel          => { type => 'boolean', default => 'false' },
+  assembly           => { type => 'boolean', default => 'false' },
+  alternate          => { type => 'boolean', default => 'false' },
+  rop                => { type => 'float', precision => 4 },
+  inventory_accno_id => { type => 'integer' },
+  income_accno_id    => { type => 'integer' },
+  expense_accno_id   => { type => 'integer' },
+  shop               => { type => 'boolean', default => 'false' },
+  obsolete           => { type => 'boolean', default => 'false' },
+  bom                => { type => 'boolean', default => 'false' },
+  image              => { type => 'text' },
+  drawing            => { type => 'text' },
+  microfiche         => { type => 'text' },
+  partsgroup_id      => { type => 'integer' },
+  ve                 => { type => 'integer' },
+  gv                 => { type => 'numeric', precision => 5, scale => 15 },
+  itime              => { type => 'timestamp', default => 'now()' },
+  mtime              => { type => 'timestamp' },
+  unit               => { type => 'varchar', length => 20, not_null => 1 },
+  formel             => { type => 'text' },
+  not_discountable   => { type => 'boolean', default => 'false' },
+  buchungsgruppen_id => { type => 'integer' },
+  payment_id         => { type => 'integer' },
+  ean                => { type => 'text' },
+  price_factor_id    => { type => 'integer' },
+  onhand             => { type => 'numeric', default => '0', precision => 5, scale => 25 },
+  stockable          => { type => 'boolean', default => 'false' },
+  has_sernumber      => { type => 'boolean', default => 'false' },
+  warehouse_id       => { type => 'integer' },
+  bin_id             => { type => 'integer' },
+);
 
-  foreign_keys => [
-    bin => {
-      class       => 'SL::DB::Bin',
-      key_columns => { bin_id => 'id' },
-    },
+__PACKAGE__->meta->primary_key_columns([ 'id' ]);
 
-    buchungsgruppen => {
-      class       => 'SL::DB::Buchungsgruppe',
-      key_columns => { buchungsgruppen_id => 'id' },
-    },
+__PACKAGE__->meta->unique_keys([ 'partnumber' ]);
 
-    partsgroup => {
-      class       => 'SL::DB::PartsGroup',
-      key_columns => { partsgroup_id => 'id' },
-    },
+__PACKAGE__->meta->allow_inline_column_values(1);
 
-    payment => {
-      class       => 'SL::DB::PaymentTerm',
-      key_columns => { payment_id => 'id' },
-    },
+__PACKAGE__->meta->foreign_keys(
+  bin => {
+    class       => 'SL::DB::Bin',
+    key_columns => { bin_id => 'id' },
+  },
 
-    price_factor => {
-      class       => 'SL::DB::PriceFactor',
-      key_columns => { price_factor_id => 'id' },
-    },
+  buchungsgruppen => {
+    class       => 'SL::DB::Buchungsgruppe',
+    key_columns => { buchungsgruppen_id => 'id' },
+  },
 
-    unit_obj => {
-      class       => 'SL::DB::Unit',
-      key_columns => { unit => 'name' },
-    },
+  unit_obj => {
+    class       => 'SL::DB::Unit',
+    key_columns => { unit => 'name' },
+  },
 
-    warehouse => {
-      class       => 'SL::DB::Warehouse',
-      key_columns => { warehouse_id => 'id' },
-    },
-  ],
+  warehouse => {
+    class       => 'SL::DB::Warehouse',
+    key_columns => { warehouse_id => 'id' },
+  },
 );
 
+# __PACKAGE__->meta->initialize;
+
 1;
 ;