X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FMetaSetup%2FUnit.pm;h=ec23013274a70ad508e0d3dcadc1efc1cb8d9a26;hb=d4925a8b60f04674885e30d9316dc0263f8b9a84;hp=6e05737df11cd86d8320b700458f48ab7d1de76f;hpb=de0f9532013c861dae78aa01b9633284d1ceee7c;p=kivitendo-erp.git diff --git a/SL/DB/MetaSetup/Unit.pm b/SL/DB/MetaSetup/Unit.pm index 6e05737df..ec2301327 100644 --- a/SL/DB/MetaSetup/Unit.pm +++ b/SL/DB/MetaSetup/Unit.pm @@ -4,30 +4,28 @@ package SL::DB::Unit; use strict; -use base qw(SL::DB::Object); - -__PACKAGE__->meta->setup( - table => 'units', - - columns => [ - name => { type => 'varchar', length => 20, not_null => 1 }, - base_unit => { type => 'varchar', length => 20 }, - factor => { type => 'numeric', precision => 5, scale => 20 }, - type => { type => 'varchar', length => 20 }, - sortkey => { type => 'integer', not_null => 1 }, - id => { type => 'serial', not_null => 1 }, - ], - - primary_key_columns => [ 'name' ], - - unique_key => [ 'id' ], - - foreign_keys => [ - unit => { - class => 'SL::DB::Unit', - key_columns => { base_unit => 'name' }, - }, - ], +use parent qw(SL::DB::Object); + +__PACKAGE__->meta->table('units'); + +__PACKAGE__->meta->columns( + base_unit => { type => 'varchar', length => 20 }, + factor => { type => 'numeric', precision => 20, scale => 5 }, + id => { type => 'serial', not_null => 1 }, + name => { type => 'varchar', length => 20, not_null => 1 }, + sortkey => { type => 'integer', not_null => 1 }, + type => { type => 'varchar', length => 20 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'name' ]); + +__PACKAGE__->meta->unique_keys([ 'id' ]); + +__PACKAGE__->meta->foreign_keys( + unit => { + class => 'SL::DB::Unit', + key_columns => { base_unit => 'name' }, + }, ); 1;