From b8b112a39bd601b0bc717646d78de470631da22a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 20 Jun 2013 18:58:07 +0200 Subject: [PATCH] MetaSetup neu generiert --- SL/DB/MetaSetup/AccTransaction.pm | 88 ++++----- SL/DB/MetaSetup/Assembly.pm | 32 +-- SL/DB/MetaSetup/AuditTrail.pm | 28 +-- SL/DB/MetaSetup/AuthClient.pm | 42 ++-- SL/DB/MetaSetup/AuthClientGroup.pm | 44 ++--- SL/DB/MetaSetup/AuthClientUser.pm | 44 ++--- SL/DB/MetaSetup/AuthGroup.pm | 22 +-- SL/DB/MetaSetup/AuthGroupRight.pm | 36 ++-- SL/DB/MetaSetup/AuthUser.pm | 22 +-- SL/DB/MetaSetup/AuthUserConfig.pm | 36 ++-- SL/DB/MetaSetup/AuthUserGroup.pm | 44 ++--- SL/DB/MetaSetup/BackgroundJob.pm | 28 +-- SL/DB/MetaSetup/BackgroundJobHistory.pm | 26 +-- SL/DB/MetaSetup/BankAccount.pm | 42 ++-- SL/DB/MetaSetup/Bin.pm | 42 ++-- SL/DB/MetaSetup/Buchungsgruppe.pm | 36 ++-- SL/DB/MetaSetup/Business.pm | 32 +-- SL/DB/MetaSetup/Chart.pm | 52 ++--- SL/DB/MetaSetup/Contact.pm | 68 +++---- SL/DB/MetaSetup/CsvImportProfile.pm | 22 +-- SL/DB/MetaSetup/CsvImportProfileSetting.pm | 40 ++-- SL/DB/MetaSetup/CsvImportReport.pm | 40 ++-- SL/DB/MetaSetup/CsvImportReportRow.pm | 38 ++-- SL/DB/MetaSetup/CsvImportReportStatus.pm | 38 ++-- SL/DB/MetaSetup/Currency.pm | 30 ++- SL/DB/MetaSetup/CustomVariable.pm | 52 ++--- SL/DB/MetaSetup/CustomVariableConfig.pm | 46 ++--- SL/DB/MetaSetup/CustomVariableValidity.pm | 40 ++-- SL/DB/MetaSetup/Customer.pm | 132 ++++++------- SL/DB/MetaSetup/Datev.pm | 36 ++-- SL/DB/MetaSetup/Default.pm | 204 ++++++++++---------- SL/DB/MetaSetup/DeliveryOrder.pm | 143 ++++++-------- SL/DB/MetaSetup/DeliveryOrderItem.pm | 98 +++++----- SL/DB/MetaSetup/DeliveryOrderItemsStock.pm | 72 +++---- SL/DB/MetaSetup/Department.pm | 34 +++- SL/DB/MetaSetup/Draft.pm | 39 ++-- SL/DB/MetaSetup/Dunning.pm | 61 +++--- SL/DB/MetaSetup/DunningConfig.pm | 58 +++--- SL/DB/MetaSetup/Employee.pm | 80 +++++--- SL/DB/MetaSetup/Exchangerate.pm | 46 ++--- SL/DB/MetaSetup/Finanzamt.pm | 54 +++--- SL/DB/MetaSetup/FollowUp.pm | 71 +++---- SL/DB/MetaSetup/FollowUpAccess.pm | 44 ++--- SL/DB/MetaSetup/FollowUpLink.pm | 39 ++-- SL/DB/MetaSetup/GLTransaction.pm | 82 ++++---- SL/DB/MetaSetup/GenericTranslation.pm | 27 +-- SL/DB/MetaSetup/History.pm | 46 ++--- SL/DB/MetaSetup/Inventory.pm | 98 +++++----- SL/DB/MetaSetup/Invoice.pm | 184 +++++++----------- SL/DB/MetaSetup/InvoiceItem.pm | 102 +++++----- SL/DB/MetaSetup/Language.pm | 62 ++++-- SL/DB/MetaSetup/MakeModel.pm | 36 ++-- SL/DB/MetaSetup/Note.pm | 56 +++--- SL/DB/MetaSetup/Order.pm | 214 ++++++++++----------- SL/DB/MetaSetup/OrderItem.pm | 110 +++++------ SL/DB/MetaSetup/Part.pm | 142 ++++++-------- SL/DB/MetaSetup/PartsGroup.pm | 28 ++- SL/DB/MetaSetup/PaymentTerm.pm | 70 +++++-- SL/DB/MetaSetup/PeriodicInvoice.pm | 47 ++--- SL/DB/MetaSetup/PeriodicInvoicesConfig.pm | 76 ++++---- SL/DB/MetaSetup/Price.pm | 46 ++--- SL/DB/MetaSetup/PriceFactor.pm | 38 +++- SL/DB/MetaSetup/Pricegroup.pm | 34 +++- SL/DB/MetaSetup/Printer.pm | 26 ++- SL/DB/MetaSetup/Project.pm | 54 +++--- SL/DB/MetaSetup/PurchaseInvoice.pm | 145 ++++++-------- SL/DB/MetaSetup/RecordLink.pm | 26 +-- SL/DB/MetaSetup/SchemaInfo.pm | 20 +- SL/DB/MetaSetup/SepaExport.pm | 44 ++--- SL/DB/MetaSetup/SepaExportItem.pm | 88 ++++----- SL/DB/MetaSetup/Shipto.pm | 72 ++++--- SL/DB/MetaSetup/Status.pm | 36 ++-- SL/DB/MetaSetup/Tax.pm | 50 ++--- SL/DB/MetaSetup/TaxKey.pm | 54 +++--- SL/DB/MetaSetup/TaxZone.pm | 16 +- SL/DB/MetaSetup/TodoUserConfig.pm | 42 ++-- SL/DB/MetaSetup/TransferType.pm | 32 +-- SL/DB/MetaSetup/Translation.pm | 46 ++--- SL/DB/MetaSetup/Unit.pm | 44 ++--- SL/DB/MetaSetup/UnitsLanguage.pm | 48 ++--- SL/DB/MetaSetup/Vendor.pm | 134 ++++++------- SL/DB/MetaSetup/Warehouse.pm | 26 +-- 82 files changed, 2440 insertions(+), 2382 deletions(-) diff --git a/SL/DB/MetaSetup/AccTransaction.pm b/SL/DB/MetaSetup/AccTransaction.pm index e16dfd116..7bc07d08e 100644 --- a/SL/DB/MetaSetup/AccTransaction.pm +++ b/SL/DB/MetaSetup/AccTransaction.pm @@ -6,51 +6,51 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'acc_trans', - - columns => [ - acc_trans_id => { type => 'bigint', not_null => 1, sequence => 'acc_trans_id_seq' }, - trans_id => { type => 'integer', not_null => 1 }, - chart_id => { type => 'integer', not_null => 1 }, - amount => { type => 'numeric', precision => 5, scale => 15 }, - transdate => { type => 'date', default => 'now' }, - gldate => { type => 'date', default => 'now' }, - source => { type => 'text' }, - cleared => { type => 'boolean', default => 'false', not_null => 1 }, - fx_transaction => { type => 'boolean', default => 'false', not_null => 1 }, - ob_transaction => { type => 'boolean', default => 'false', not_null => 1 }, - cb_transaction => { type => 'boolean', default => 'false', not_null => 1 }, - project_id => { type => 'integer' }, - memo => { type => 'text' }, - taxkey => { type => 'integer' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - tax_id => { type => 'integer', not_null => 1 }, - chart_link => { type => 'text', not_null => 1 }, - ], - - primary_key_columns => [ 'acc_trans_id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - chart => { - class => 'SL::DB::Chart', - key_columns => { chart_id => 'id' }, - }, - - project => { - class => 'SL::DB::Project', - key_columns => { project_id => 'id' }, - }, - - tax => { - class => 'SL::DB::Tax', - key_columns => { tax_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('acc_trans'); + +__PACKAGE__->meta->columns( + acc_trans_id => { type => 'bigint', not_null => 1, sequence => 'acc_trans_id_seq' }, + trans_id => { type => 'integer', not_null => 1 }, + chart_id => { type => 'integer', not_null => 1 }, + amount => { type => 'numeric', precision => 5, scale => 15 }, + transdate => { type => 'date', default => 'now' }, + gldate => { type => 'date', default => 'now' }, + source => { type => 'text' }, + cleared => { type => 'boolean', default => 'false', not_null => 1 }, + fx_transaction => { type => 'boolean', default => 'false', not_null => 1 }, + ob_transaction => { type => 'boolean', default => 'false', not_null => 1 }, + cb_transaction => { type => 'boolean', default => 'false', not_null => 1 }, + project_id => { type => 'integer' }, + memo => { type => 'text' }, + taxkey => { type => 'integer' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + tax_id => { type => 'integer', not_null => 1 }, + chart_link => { type => 'text', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'acc_trans_id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + chart => { + class => 'SL::DB::Chart', + key_columns => { chart_id => 'id' }, + }, + + project => { + class => 'SL::DB::Project', + key_columns => { project_id => 'id' }, + }, + + tax => { + class => 'SL::DB::Tax', + key_columns => { tax_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Assembly.pm b/SL/DB/MetaSetup/Assembly.pm index 801662db6..f74883962 100644 --- a/SL/DB/MetaSetup/Assembly.pm +++ b/SL/DB/MetaSetup/Assembly.pm @@ -6,23 +6,23 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'assembly', - - columns => [ - id => { type => 'integer' }, - parts_id => { type => 'integer' }, - qty => { type => 'float', precision => 4 }, - bom => { type => 'boolean' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - assembly_id => { type => 'serial', not_null => 1 }, - ], - - primary_key_columns => [ 'assembly_id' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->table('assembly'); + +__PACKAGE__->meta->columns( + id => { type => 'integer' }, + parts_id => { type => 'integer' }, + qty => { type => 'float', precision => 4 }, + bom => { type => 'boolean' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + assembly_id => { type => 'serial', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'assembly_id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/AuditTrail.pm b/SL/DB/MetaSetup/AuditTrail.pm index 0edc6edd7..d86a43f7f 100644 --- a/SL/DB/MetaSetup/AuditTrail.pm +++ b/SL/DB/MetaSetup/AuditTrail.pm @@ -6,22 +6,22 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'audittrail', +__PACKAGE__->meta->table('audittrail'); - columns => [ - trans_id => { type => 'integer' }, - tablename => { type => 'text' }, - reference => { type => 'text' }, - formname => { type => 'text' }, - action => { type => 'text' }, - transdate => { type => 'timestamp', default => 'now' }, - employee_id => { type => 'integer' }, - id => { type => 'serial', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->columns( + trans_id => { type => 'integer' }, + tablename => { type => 'text' }, + reference => { type => 'text' }, + formname => { type => 'text' }, + action => { type => 'text' }, + transdate => { type => 'timestamp', default => 'now' }, + employee_id => { type => 'integer' }, + id => { type => 'serial', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/AuthClient.pm b/SL/DB/MetaSetup/AuthClient.pm index b78050cf0..8eb841cdd 100644 --- a/SL/DB/MetaSetup/AuthClient.pm +++ b/SL/DB/MetaSetup/AuthClient.pm @@ -6,28 +6,28 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'clients', - schema => 'auth', - - columns => [ - id => { type => 'serial', not_null => 1 }, - name => { type => 'text', not_null => 1 }, - dbhost => { type => 'text', not_null => 1 }, - dbport => { type => 'integer', default => 5432, not_null => 1 }, - dbname => { type => 'text', not_null => 1 }, - dbuser => { type => 'text', not_null => 1 }, - dbpasswd => { type => 'text', not_null => 1 }, - is_default => { type => 'boolean', default => 'false', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - unique_keys => [ - [ 'dbhost', 'dbport', 'dbname' ], - [ 'name' ], - ], +__PACKAGE__->meta->table('clients'); +__PACKAGE__->meta->schema('auth'); + +__PACKAGE__->meta->columns( + id => { type => 'serial', not_null => 1 }, + name => { type => 'text', not_null => 1 }, + dbhost => { type => 'text', not_null => 1 }, + dbport => { type => 'integer', default => 5432, not_null => 1 }, + dbname => { type => 'text', not_null => 1 }, + dbuser => { type => 'text', not_null => 1 }, + dbpasswd => { type => 'text', not_null => 1 }, + is_default => { type => 'boolean', default => 'false', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->unique_keys( + [ 'dbhost', 'dbport', 'dbname' ], + [ 'name' ], +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/AuthClientGroup.pm b/SL/DB/MetaSetup/AuthClientGroup.pm index f4e2f8756..9eac68415 100644 --- a/SL/DB/MetaSetup/AuthClientGroup.pm +++ b/SL/DB/MetaSetup/AuthClientGroup.pm @@ -6,29 +6,29 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'clients_groups', - schema => 'auth', - - columns => [ - client_id => { type => 'integer', not_null => 1 }, - group_id => { type => 'integer', not_null => 1 }, - ], - - primary_key_columns => [ 'client_id', 'group_id' ], - - foreign_keys => [ - client => { - class => 'SL::DB::AuthClient', - key_columns => { client_id => 'id' }, - }, - - group => { - class => 'SL::DB::AuthGroup', - key_columns => { group_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('clients_groups'); +__PACKAGE__->meta->schema('auth'); + +__PACKAGE__->meta->columns( + client_id => { type => 'integer', not_null => 1 }, + group_id => { type => 'integer', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'client_id', 'group_id' ]); + +__PACKAGE__->meta->foreign_keys( + client => { + class => 'SL::DB::AuthClient', + key_columns => { client_id => 'id' }, + }, + + group => { + class => 'SL::DB::AuthGroup', + key_columns => { group_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/AuthClientUser.pm b/SL/DB/MetaSetup/AuthClientUser.pm index 85d0ef953..88a5177f1 100644 --- a/SL/DB/MetaSetup/AuthClientUser.pm +++ b/SL/DB/MetaSetup/AuthClientUser.pm @@ -6,29 +6,29 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'clients_users', - schema => 'auth', - - columns => [ - client_id => { type => 'integer', not_null => 1 }, - user_id => { type => 'integer', not_null => 1 }, - ], - - primary_key_columns => [ 'client_id', 'user_id' ], - - foreign_keys => [ - client => { - class => 'SL::DB::AuthClient', - key_columns => { client_id => 'id' }, - }, - - user => { - class => 'SL::DB::AuthUser', - key_columns => { user_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('clients_users'); +__PACKAGE__->meta->schema('auth'); + +__PACKAGE__->meta->columns( + client_id => { type => 'integer', not_null => 1 }, + user_id => { type => 'integer', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'client_id', 'user_id' ]); + +__PACKAGE__->meta->foreign_keys( + client => { + class => 'SL::DB::AuthClient', + key_columns => { client_id => 'id' }, + }, + + user => { + class => 'SL::DB::AuthUser', + key_columns => { user_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/AuthGroup.pm b/SL/DB/MetaSetup/AuthGroup.pm index 9e75aac33..2671cef8b 100644 --- a/SL/DB/MetaSetup/AuthGroup.pm +++ b/SL/DB/MetaSetup/AuthGroup.pm @@ -6,20 +6,20 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'group', - schema => 'auth', +__PACKAGE__->meta->table('group'); +__PACKAGE__->meta->schema('auth'); - columns => [ - id => { type => 'serial', not_null => 1 }, - name => { type => 'text', not_null => 1 }, - description => { type => 'text' }, - ], +__PACKAGE__->meta->columns( + id => { type => 'serial', not_null => 1 }, + name => { type => 'text', not_null => 1 }, + description => { type => 'text' }, +); - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - unique_key => [ 'name' ], -); +__PACKAGE__->meta->unique_keys([ 'name' ]); + +# __PACKAGE__->meta->initialize; 1; ; diff --git a/SL/DB/MetaSetup/AuthGroupRight.pm b/SL/DB/MetaSetup/AuthGroupRight.pm index 7c98d2ab2..1befd3180 100644 --- a/SL/DB/MetaSetup/AuthGroupRight.pm +++ b/SL/DB/MetaSetup/AuthGroupRight.pm @@ -6,25 +6,25 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'group_rights', - schema => 'auth', - - columns => [ - group_id => { type => 'integer', not_null => 1 }, - right => { type => 'text', not_null => 1 }, - granted => { type => 'boolean', not_null => 1 }, - ], - - primary_key_columns => [ 'group_id', 'right' ], - - foreign_keys => [ - group => { - class => 'SL::DB::AuthGroup', - key_columns => { group_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('group_rights'); +__PACKAGE__->meta->schema('auth'); + +__PACKAGE__->meta->columns( + group_id => { type => 'integer', not_null => 1 }, + right => { type => 'text', not_null => 1 }, + granted => { type => 'boolean', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'group_id', 'right' ]); + +__PACKAGE__->meta->foreign_keys( + group => { + class => 'SL::DB::AuthGroup', + key_columns => { group_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/AuthUser.pm b/SL/DB/MetaSetup/AuthUser.pm index 217519041..50b87ed11 100644 --- a/SL/DB/MetaSetup/AuthUser.pm +++ b/SL/DB/MetaSetup/AuthUser.pm @@ -6,20 +6,20 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'user', - schema => 'auth', +__PACKAGE__->meta->table('user'); +__PACKAGE__->meta->schema('auth'); - columns => [ - id => { type => 'serial', not_null => 1 }, - login => { type => 'text', not_null => 1 }, - password => { type => 'text' }, - ], +__PACKAGE__->meta->columns( + id => { type => 'serial', not_null => 1 }, + login => { type => 'text', not_null => 1 }, + password => { type => 'text' }, +); - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - unique_key => [ 'login' ], -); +__PACKAGE__->meta->unique_keys([ 'login' ]); + +# __PACKAGE__->meta->initialize; 1; ; diff --git a/SL/DB/MetaSetup/AuthUserConfig.pm b/SL/DB/MetaSetup/AuthUserConfig.pm index ef9e34895..54ea6ce9d 100644 --- a/SL/DB/MetaSetup/AuthUserConfig.pm +++ b/SL/DB/MetaSetup/AuthUserConfig.pm @@ -6,25 +6,25 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'user_config', - schema => 'auth', - - columns => [ - user_id => { type => 'integer', not_null => 1 }, - cfg_key => { type => 'text', not_null => 1 }, - cfg_value => { type => 'text' }, - ], - - primary_key_columns => [ 'user_id', 'cfg_key' ], - - foreign_keys => [ - user => { - class => 'SL::DB::AuthUser', - key_columns => { user_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('user_config'); +__PACKAGE__->meta->schema('auth'); + +__PACKAGE__->meta->columns( + user_id => { type => 'integer', not_null => 1 }, + cfg_key => { type => 'text', not_null => 1 }, + cfg_value => { type => 'text' }, ); +__PACKAGE__->meta->primary_key_columns([ 'user_id', 'cfg_key' ]); + +__PACKAGE__->meta->foreign_keys( + user => { + class => 'SL::DB::AuthUser', + key_columns => { user_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/AuthUserGroup.pm b/SL/DB/MetaSetup/AuthUserGroup.pm index 226921f3c..6b470cf6c 100644 --- a/SL/DB/MetaSetup/AuthUserGroup.pm +++ b/SL/DB/MetaSetup/AuthUserGroup.pm @@ -6,29 +6,29 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'user_group', - schema => 'auth', - - columns => [ - user_id => { type => 'integer', not_null => 1 }, - group_id => { type => 'integer', not_null => 1 }, - ], - - primary_key_columns => [ 'user_id', 'group_id' ], - - foreign_keys => [ - group => { - class => 'SL::DB::AuthGroup', - key_columns => { group_id => 'id' }, - }, - - user => { - class => 'SL::DB::AuthUser', - key_columns => { user_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('user_group'); +__PACKAGE__->meta->schema('auth'); + +__PACKAGE__->meta->columns( + user_id => { type => 'integer', not_null => 1 }, + group_id => { type => 'integer', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'user_id', 'group_id' ]); + +__PACKAGE__->meta->foreign_keys( + group => { + class => 'SL::DB::AuthGroup', + key_columns => { group_id => 'id' }, + }, + + user => { + class => 'SL::DB::AuthUser', + key_columns => { user_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/BackgroundJob.pm b/SL/DB/MetaSetup/BackgroundJob.pm index c3b8212c9..0716443ab 100644 --- a/SL/DB/MetaSetup/BackgroundJob.pm +++ b/SL/DB/MetaSetup/BackgroundJob.pm @@ -6,22 +6,22 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'background_jobs', +__PACKAGE__->meta->table('background_jobs'); - columns => [ - id => { type => 'serial', not_null => 1 }, - type => { type => 'varchar', length => 255 }, - package_name => { type => 'varchar', length => 255 }, - last_run_at => { type => 'timestamp' }, - next_run_at => { type => 'timestamp' }, - data => { type => 'text' }, - active => { type => 'boolean' }, - cron_spec => { type => 'varchar', length => 255 }, - ], - - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->columns( + id => { type => 'serial', not_null => 1 }, + type => { type => 'varchar', length => 255 }, + package_name => { type => 'varchar', length => 255 }, + last_run_at => { type => 'timestamp' }, + next_run_at => { type => 'timestamp' }, + data => { type => 'text' }, + active => { type => 'boolean' }, + cron_spec => { type => 'varchar', length => 255 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/BackgroundJobHistory.pm b/SL/DB/MetaSetup/BackgroundJobHistory.pm index bd78a7d50..6fb3e2b42 100644 --- a/SL/DB/MetaSetup/BackgroundJobHistory.pm +++ b/SL/DB/MetaSetup/BackgroundJobHistory.pm @@ -6,21 +6,21 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'background_job_histories', +__PACKAGE__->meta->table('background_job_histories'); - columns => [ - id => { type => 'serial', not_null => 1 }, - package_name => { type => 'varchar', length => 255 }, - run_at => { type => 'timestamp' }, - status => { type => 'varchar', length => 255 }, - result => { type => 'text' }, - error => { type => 'text', alias => 'error_col' }, - data => { type => 'text' }, - ], - - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->columns( + id => { type => 'serial', not_null => 1 }, + package_name => { type => 'varchar', length => 255 }, + run_at => { type => 'timestamp' }, + status => { type => 'varchar', length => 255 }, + result => { type => 'text' }, + error => { type => 'text', alias => 'error_col' }, + data => { type => 'text' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/BankAccount.pm b/SL/DB/MetaSetup/BankAccount.pm index 5cd8e7a39..94eec593e 100644 --- a/SL/DB/MetaSetup/BankAccount.pm +++ b/SL/DB/MetaSetup/BankAccount.pm @@ -6,28 +6,28 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'bank_accounts', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - account_number => { type => 'varchar', length => 100 }, - bank_code => { type => 'varchar', length => 100 }, - iban => { type => 'varchar', length => 100 }, - bic => { type => 'varchar', length => 100 }, - bank => { type => 'text' }, - chart_id => { type => 'integer', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - foreign_keys => [ - chart => { - class => 'SL::DB::Chart', - key_columns => { chart_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('bank_accounts'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + account_number => { type => 'varchar', length => 100 }, + bank_code => { type => 'varchar', length => 100 }, + iban => { type => 'varchar', length => 100 }, + bic => { type => 'varchar', length => 100 }, + bank => { type => 'text' }, + chart_id => { type => 'integer', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->foreign_keys( + chart => { + class => 'SL::DB::Chart', + key_columns => { chart_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Bin.pm b/SL/DB/MetaSetup/Bin.pm index ff225207f..df0510361 100644 --- a/SL/DB/MetaSetup/Bin.pm +++ b/SL/DB/MetaSetup/Bin.pm @@ -6,28 +6,28 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'bin', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - warehouse_id => { type => 'integer', not_null => 1 }, - description => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - warehouse => { - class => 'SL::DB::Warehouse', - key_columns => { warehouse_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('bin'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + warehouse_id => { type => 'integer', not_null => 1 }, + description => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + warehouse => { + class => 'SL::DB::Warehouse', + key_columns => { warehouse_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Buchungsgruppe.pm b/SL/DB/MetaSetup/Buchungsgruppe.pm index 8acc5a75f..8845dbb81 100644 --- a/SL/DB/MetaSetup/Buchungsgruppe.pm +++ b/SL/DB/MetaSetup/Buchungsgruppe.pm @@ -6,26 +6,26 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'buchungsgruppen', +__PACKAGE__->meta->table('buchungsgruppen'); - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - description => { type => 'text' }, - inventory_accno_id => { type => 'integer' }, - income_accno_id_0 => { type => 'integer' }, - expense_accno_id_0 => { type => 'integer' }, - income_accno_id_1 => { type => 'integer' }, - expense_accno_id_1 => { type => 'integer' }, - income_accno_id_2 => { type => 'integer' }, - expense_accno_id_2 => { type => 'integer' }, - income_accno_id_3 => { type => 'integer' }, - expense_accno_id_3 => { type => 'integer' }, - sortkey => { type => 'integer', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + description => { type => 'text' }, + inventory_accno_id => { type => 'integer' }, + income_accno_id_0 => { type => 'integer' }, + expense_accno_id_0 => { type => 'integer' }, + income_accno_id_1 => { type => 'integer' }, + expense_accno_id_1 => { type => 'integer' }, + income_accno_id_2 => { type => 'integer' }, + expense_accno_id_2 => { type => 'integer' }, + income_accno_id_3 => { type => 'integer' }, + expense_accno_id_3 => { type => 'integer' }, + sortkey => { type => 'integer', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Business.pm b/SL/DB/MetaSetup/Business.pm index 243d524f4..d04b2bc05 100644 --- a/SL/DB/MetaSetup/Business.pm +++ b/SL/DB/MetaSetup/Business.pm @@ -6,23 +6,23 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'business', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - description => { type => 'text' }, - discount => { type => 'float', precision => 4 }, - customernumberinit => { type => 'text' }, - salesman => { type => 'boolean', default => 'false' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->table('business'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + description => { type => 'text' }, + discount => { type => 'float', precision => 4 }, + customernumberinit => { type => 'text' }, + salesman => { type => 'boolean', default => 'false' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Chart.pm b/SL/DB/MetaSetup/Chart.pm index 7903a3a10..980b2bd5d 100644 --- a/SL/DB/MetaSetup/Chart.pm +++ b/SL/DB/MetaSetup/Chart.pm @@ -6,33 +6,33 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'chart', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - accno => { type => 'text', not_null => 1 }, - description => { type => 'text' }, - charttype => { type => 'character', default => 'A', length => 1 }, - category => { type => 'character', length => 1 }, - link => { type => 'text', not_null => 1 }, - taxkey_id => { type => 'integer' }, - pos_bwa => { type => 'integer' }, - pos_bilanz => { type => 'integer' }, - pos_eur => { type => 'integer' }, - datevautomatik => { type => 'boolean', default => 'false' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - new_chart_id => { type => 'integer' }, - valid_from => { type => 'date' }, - ], - - primary_key_columns => [ 'id' ], - - unique_key => [ 'accno' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->table('chart'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + accno => { type => 'text', not_null => 1 }, + description => { type => 'text' }, + charttype => { type => 'character', default => 'A', length => 1 }, + category => { type => 'character', length => 1 }, + link => { type => 'text', not_null => 1 }, + taxkey_id => { type => 'integer' }, + pos_bwa => { type => 'integer' }, + pos_bilanz => { type => 'integer' }, + pos_eur => { type => 'integer' }, + datevautomatik => { type => 'boolean', default => 'false' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + new_chart_id => { type => 'integer' }, + valid_from => { type => 'date' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->unique_keys([ 'accno' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Contact.pm b/SL/DB/MetaSetup/Contact.pm index 225a4c795..4287a561d 100644 --- a/SL/DB/MetaSetup/Contact.pm +++ b/SL/DB/MetaSetup/Contact.pm @@ -6,41 +6,41 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'contacts', - - columns => [ - cp_id => { type => 'integer', not_null => 1, sequence => 'id' }, - cp_cv_id => { type => 'integer' }, - cp_title => { type => 'varchar', length => 75 }, - cp_givenname => { type => 'varchar', length => 75 }, - cp_name => { type => 'varchar', length => 75 }, - cp_email => { type => 'text' }, - cp_phone1 => { type => 'varchar', length => 75 }, - cp_phone2 => { type => 'varchar', length => 75 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - cp_fax => { type => 'text' }, - cp_mobile1 => { type => 'text' }, - cp_mobile2 => { type => 'text' }, - cp_satphone => { type => 'text' }, - cp_satfax => { type => 'text' }, - cp_project => { type => 'text' }, - cp_privatphone => { type => 'text' }, - cp_privatemail => { type => 'text' }, - cp_abteilung => { type => 'text' }, - cp_gender => { type => 'character', length => 1 }, - cp_street => { type => 'text' }, - cp_zipcode => { type => 'text' }, - cp_city => { type => 'text' }, - cp_birthday => { type => 'date' }, - cp_position => { type => 'varchar', length => 75 }, - ], - - primary_key_columns => [ 'cp_id' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->table('contacts'); + +__PACKAGE__->meta->columns( + cp_id => { type => 'integer', not_null => 1, sequence => 'id' }, + cp_cv_id => { type => 'integer' }, + cp_title => { type => 'varchar', length => 75 }, + cp_givenname => { type => 'varchar', length => 75 }, + cp_name => { type => 'varchar', length => 75 }, + cp_email => { type => 'text' }, + cp_phone1 => { type => 'varchar', length => 75 }, + cp_phone2 => { type => 'varchar', length => 75 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + cp_fax => { type => 'text' }, + cp_mobile1 => { type => 'text' }, + cp_mobile2 => { type => 'text' }, + cp_satphone => { type => 'text' }, + cp_satfax => { type => 'text' }, + cp_project => { type => 'text' }, + cp_privatphone => { type => 'text' }, + cp_privatemail => { type => 'text' }, + cp_abteilung => { type => 'text' }, + cp_gender => { type => 'character', length => 1 }, + cp_street => { type => 'text' }, + cp_zipcode => { type => 'text' }, + cp_city => { type => 'text' }, + cp_birthday => { type => 'date' }, + cp_position => { type => 'varchar', length => 75 }, ); +__PACKAGE__->meta->primary_key_columns([ 'cp_id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/CsvImportProfile.pm b/SL/DB/MetaSetup/CsvImportProfile.pm index e01fe28f1..a435f8000 100644 --- a/SL/DB/MetaSetup/CsvImportProfile.pm +++ b/SL/DB/MetaSetup/CsvImportProfile.pm @@ -6,19 +6,19 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'csv_import_profiles', +__PACKAGE__->meta->table('csv_import_profiles'); - columns => [ - id => { type => 'serial', not_null => 1 }, - name => { type => 'text', not_null => 1 }, - type => { type => 'varchar', length => 20, not_null => 1 }, - is_default => { type => 'boolean', default => 'false' }, - login => { type => 'text' }, - ], - - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->columns( + id => { type => 'serial', not_null => 1 }, + name => { type => 'text', not_null => 1 }, + type => { type => 'varchar', length => 20, not_null => 1 }, + is_default => { type => 'boolean', default => 'false' }, + login => { type => 'text' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/CsvImportProfileSetting.pm b/SL/DB/MetaSetup/CsvImportProfileSetting.pm index d1822a358..17900bd4e 100644 --- a/SL/DB/MetaSetup/CsvImportProfileSetting.pm +++ b/SL/DB/MetaSetup/CsvImportProfileSetting.pm @@ -6,27 +6,27 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'csv_import_profile_settings', - - columns => [ - id => { type => 'serial', not_null => 1 }, - csv_import_profile_id => { type => 'integer', not_null => 1 }, - key => { type => 'text', not_null => 1 }, - value => { type => 'text' }, - ], - - primary_key_columns => [ 'id' ], - - unique_key => [ 'csv_import_profile_id', 'key' ], - - foreign_keys => [ - csv_import_profile => { - class => 'SL::DB::CsvImportProfile', - key_columns => { csv_import_profile_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('csv_import_profile_settings'); + +__PACKAGE__->meta->columns( + id => { type => 'serial', not_null => 1 }, + csv_import_profile_id => { type => 'integer', not_null => 1 }, + key => { type => 'text', not_null => 1 }, + value => { type => 'text' }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->unique_keys([ 'csv_import_profile_id', 'key' ]); + +__PACKAGE__->meta->foreign_keys( + csv_import_profile => { + class => 'SL::DB::CsvImportProfile', + key_columns => { csv_import_profile_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/CsvImportReport.pm b/SL/DB/MetaSetup/CsvImportReport.pm index 4b61a2a17..041825dc9 100644 --- a/SL/DB/MetaSetup/CsvImportReport.pm +++ b/SL/DB/MetaSetup/CsvImportReport.pm @@ -6,27 +6,27 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'csv_import_reports', - - columns => [ - id => { type => 'serial', not_null => 1 }, - session_id => { type => 'text', not_null => 1 }, - profile_id => { type => 'integer', not_null => 1 }, - type => { type => 'text', not_null => 1 }, - file => { type => 'text', not_null => 1 }, - numrows => { type => 'integer' }, - ], - - primary_key_columns => [ 'id' ], - - foreign_keys => [ - profile => { - class => 'SL::DB::CsvImportProfile', - key_columns => { profile_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('csv_import_reports'); + +__PACKAGE__->meta->columns( + id => { type => 'serial', not_null => 1 }, + session_id => { type => 'text', not_null => 1 }, + profile_id => { type => 'integer', not_null => 1 }, + type => { type => 'text', not_null => 1 }, + file => { type => 'text', not_null => 1 }, + numrows => { type => 'integer' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->foreign_keys( + profile => { + class => 'SL::DB::CsvImportProfile', + key_columns => { profile_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/CsvImportReportRow.pm b/SL/DB/MetaSetup/CsvImportReportRow.pm index 5bc633722..9814a64ed 100644 --- a/SL/DB/MetaSetup/CsvImportReportRow.pm +++ b/SL/DB/MetaSetup/CsvImportReportRow.pm @@ -6,26 +6,26 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'csv_import_report_rows', - - columns => [ - id => { type => 'serial', not_null => 1 }, - csv_import_report_id => { type => 'integer', not_null => 1 }, - col => { type => 'integer', not_null => 1 }, - row => { type => 'integer', not_null => 1 }, - value => { type => 'text' }, - ], - - primary_key_columns => [ 'id' ], - - foreign_keys => [ - csv_import_report => { - class => 'SL::DB::CsvImportReport', - key_columns => { csv_import_report_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('csv_import_report_rows'); + +__PACKAGE__->meta->columns( + id => { type => 'serial', not_null => 1 }, + csv_import_report_id => { type => 'integer', not_null => 1 }, + col => { type => 'integer', not_null => 1 }, + row => { type => 'integer', not_null => 1 }, + value => { type => 'text' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->foreign_keys( + csv_import_report => { + class => 'SL::DB::CsvImportReport', + key_columns => { csv_import_report_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/CsvImportReportStatus.pm b/SL/DB/MetaSetup/CsvImportReportStatus.pm index 580b638f1..89f02a417 100644 --- a/SL/DB/MetaSetup/CsvImportReportStatus.pm +++ b/SL/DB/MetaSetup/CsvImportReportStatus.pm @@ -6,26 +6,26 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'csv_import_report_status', - - columns => [ - id => { type => 'serial', not_null => 1 }, - csv_import_report_id => { type => 'integer', not_null => 1 }, - row => { type => 'integer', not_null => 1 }, - type => { type => 'text', not_null => 1 }, - value => { type => 'text' }, - ], - - primary_key_columns => [ 'id' ], - - foreign_keys => [ - csv_import_report => { - class => 'SL::DB::CsvImportReport', - key_columns => { csv_import_report_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('csv_import_report_status'); + +__PACKAGE__->meta->columns( + id => { type => 'serial', not_null => 1 }, + csv_import_report_id => { type => 'integer', not_null => 1 }, + row => { type => 'integer', not_null => 1 }, + type => { type => 'text', not_null => 1 }, + value => { type => 'text' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->foreign_keys( + csv_import_report => { + class => 'SL::DB::CsvImportReport', + key_columns => { csv_import_report_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Currency.pm b/SL/DB/MetaSetup/Currency.pm index 705467f03..c07ef656b 100644 --- a/SL/DB/MetaSetup/Currency.pm +++ b/SL/DB/MetaSetup/Currency.pm @@ -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; ; diff --git a/SL/DB/MetaSetup/CustomVariable.pm b/SL/DB/MetaSetup/CustomVariable.pm index be839d921..907d78d58 100644 --- a/SL/DB/MetaSetup/CustomVariable.pm +++ b/SL/DB/MetaSetup/CustomVariable.pm @@ -6,33 +6,33 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'custom_variables', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'custom_variables_id' }, - config_id => { type => 'integer', not_null => 1 }, - trans_id => { type => 'integer', not_null => 1 }, - bool_value => { type => 'boolean' }, - timestamp_value => { type => 'timestamp' }, - text_value => { type => 'text' }, - number_value => { type => 'numeric', precision => 5, scale => 25 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - sub_module => { type => 'text', default => '', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - config => { - class => 'SL::DB::CustomVariableConfig', - key_columns => { config_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('custom_variables'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'custom_variables_id' }, + config_id => { type => 'integer', not_null => 1 }, + trans_id => { type => 'integer', not_null => 1 }, + bool_value => { type => 'boolean' }, + timestamp_value => { type => 'timestamp' }, + text_value => { type => 'text' }, + number_value => { type => 'numeric', precision => 5, scale => 25 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + sub_module => { type => 'text', default => '', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + config => { + class => 'SL::DB::CustomVariableConfig', + key_columns => { config_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/CustomVariableConfig.pm b/SL/DB/MetaSetup/CustomVariableConfig.pm index c4077f805..9ebed947e 100644 --- a/SL/DB/MetaSetup/CustomVariableConfig.pm +++ b/SL/DB/MetaSetup/CustomVariableConfig.pm @@ -6,30 +6,30 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'custom_variable_configs', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'custom_variable_configs_id' }, - name => { type => 'text', not_null => 1 }, - description => { type => 'text', not_null => 1 }, - type => { type => 'text', not_null => 1 }, - module => { type => 'text', not_null => 1 }, - default_value => { type => 'text' }, - options => { type => 'text' }, - searchable => { type => 'boolean', not_null => 1 }, - includeable => { type => 'boolean', not_null => 1 }, - included_by_default => { type => 'boolean', not_null => 1 }, - sortkey => { type => 'integer', not_null => 1 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - flags => { type => 'text' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->table('custom_variable_configs'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'custom_variable_configs_id' }, + name => { type => 'text', not_null => 1 }, + description => { type => 'text', not_null => 1 }, + type => { type => 'text', not_null => 1 }, + module => { type => 'text', not_null => 1 }, + default_value => { type => 'text' }, + options => { type => 'text' }, + searchable => { type => 'boolean', not_null => 1 }, + includeable => { type => 'boolean', not_null => 1 }, + included_by_default => { type => 'boolean', not_null => 1 }, + sortkey => { type => 'integer', not_null => 1 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + flags => { type => 'text' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/CustomVariableValidity.pm b/SL/DB/MetaSetup/CustomVariableValidity.pm index 25876d748..3757ddcc1 100644 --- a/SL/DB/MetaSetup/CustomVariableValidity.pm +++ b/SL/DB/MetaSetup/CustomVariableValidity.pm @@ -6,27 +6,27 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'custom_variables_validity', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - config_id => { type => 'integer', not_null => 1 }, - trans_id => { type => 'integer', not_null => 1 }, - itime => { type => 'timestamp', default => 'now()' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - config => { - class => 'SL::DB::CustomVariableConfig', - key_columns => { config_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('custom_variables_validity'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + config_id => { type => 'integer', not_null => 1 }, + trans_id => { type => 'integer', not_null => 1 }, + itime => { type => 'timestamp', default => 'now()' }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + config => { + class => 'SL::DB::CustomVariableConfig', + key_columns => { config_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Customer.pm b/SL/DB/MetaSetup/Customer.pm index 0bb7cd96b..2d8a750fd 100644 --- a/SL/DB/MetaSetup/Customer.pm +++ b/SL/DB/MetaSetup/Customer.pm @@ -6,83 +6,73 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'customer', +__PACKAGE__->meta->table('customer'); - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - name => { type => 'text', not_null => 1 }, - department_1 => { type => 'varchar', length => 75 }, - department_2 => { type => 'varchar', length => 75 }, - street => { type => 'varchar', length => 75 }, - zipcode => { type => 'varchar', length => 10 }, - city => { type => 'varchar', length => 75 }, - country => { type => 'varchar', length => 75 }, - contact => { type => 'text' }, - phone => { type => 'text' }, - fax => { type => 'varchar', length => 30 }, - homepage => { type => 'text' }, - email => { type => 'text' }, - notes => { type => 'text' }, - discount => { type => 'float', precision => 4 }, - taxincluded => { type => 'boolean' }, - creditlimit => { type => 'numeric', default => '0', precision => 5, scale => 15 }, - terms => { type => 'integer', default => '0' }, - customernumber => { type => 'text' }, - cc => { type => 'text' }, - bcc => { type => 'text' }, - business_id => { type => 'integer' }, - taxnumber => { type => 'text' }, - account_number => { type => 'text' }, - bank_code => { type => 'text' }, - bank => { type => 'text' }, - language => { type => 'varchar', length => 5 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - obsolete => { type => 'boolean', default => 'false' }, - username => { type => 'varchar', length => 50 }, - user_password => { type => 'text' }, - salesman_id => { type => 'integer' }, - c_vendor_id => { type => 'text' }, - klass => { type => 'integer', default => '0' }, - language_id => { type => 'integer' }, - payment_id => { type => 'integer' }, - taxzone_id => { type => 'integer', default => '0', not_null => 1 }, - greeting => { type => 'text' }, - ustid => { type => 'text' }, - iban => { type => 'varchar', length => 100 }, - bic => { type => 'varchar', length => 100 }, - direct_debit => { type => 'boolean', default => 'false' }, - taxincluded_checked => { type => 'boolean' }, - currency_id => { type => 'integer', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + name => { type => 'text', not_null => 1 }, + department_1 => { type => 'varchar', length => 75 }, + department_2 => { type => 'varchar', length => 75 }, + street => { type => 'varchar', length => 75 }, + zipcode => { type => 'varchar', length => 10 }, + city => { type => 'varchar', length => 75 }, + country => { type => 'varchar', length => 75 }, + contact => { type => 'text' }, + phone => { type => 'text' }, + fax => { type => 'varchar', length => 30 }, + homepage => { type => 'text' }, + email => { type => 'text' }, + notes => { type => 'text' }, + discount => { type => 'float', precision => 4 }, + taxincluded => { type => 'boolean' }, + creditlimit => { type => 'numeric', default => '0', precision => 5, scale => 15 }, + terms => { type => 'integer', default => '0' }, + customernumber => { type => 'text' }, + cc => { type => 'text' }, + bcc => { type => 'text' }, + business_id => { type => 'integer' }, + taxnumber => { type => 'text' }, + account_number => { type => 'text' }, + bank_code => { type => 'text' }, + bank => { type => 'text' }, + language => { type => 'varchar', length => 5 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + obsolete => { type => 'boolean', default => 'false' }, + username => { type => 'varchar', length => 50 }, + user_password => { type => 'text' }, + salesman_id => { type => 'integer' }, + c_vendor_id => { type => 'text' }, + klass => { type => 'integer', default => '0' }, + language_id => { type => 'integer' }, + payment_id => { type => 'integer' }, + taxzone_id => { type => 'integer', default => '0', not_null => 1 }, + greeting => { type => 'text' }, + ustid => { type => 'text' }, + direct_debit => { type => 'boolean', default => 'false' }, + iban => { type => 'varchar', length => 100 }, + bic => { type => 'varchar', length => 100 }, + taxincluded_checked => { type => 'boolean' }, + currency_id => { type => 'integer', not_null => 1 }, +); - foreign_keys => [ - business => { - class => 'SL::DB::Business', - key_columns => { business_id => 'id' }, - }, +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - currency => { - class => 'SL::DB::Currency', - key_columns => { currency_id => 'id' }, - }, +__PACKAGE__->meta->allow_inline_column_values(1); - language_obj => { - class => 'SL::DB::Language', - key_columns => { language_id => 'id' }, - }, +__PACKAGE__->meta->foreign_keys( + business => { + class => 'SL::DB::Business', + key_columns => { business_id => 'id' }, + }, - payment => { - class => 'SL::DB::PaymentTerm', - key_columns => { payment_id => 'id' }, - }, - ], + currency => { + class => 'SL::DB::Currency', + key_columns => { currency_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Datev.pm b/SL/DB/MetaSetup/Datev.pm index cc03ba3a6..c0d7feee9 100644 --- a/SL/DB/MetaSetup/Datev.pm +++ b/SL/DB/MetaSetup/Datev.pm @@ -6,25 +6,25 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'datev', - - columns => [ - beraternr => { type => 'varchar', length => 7 }, - beratername => { type => 'varchar', length => 9 }, - mandantennr => { type => 'varchar', length => 5 }, - dfvkz => { type => 'varchar', length => 2 }, - datentraegernr => { type => 'varchar', length => 3 }, - abrechnungsnr => { type => 'varchar', length => 6 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - id => { type => 'serial', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->table('datev'); + +__PACKAGE__->meta->columns( + beraternr => { type => 'varchar', length => 7 }, + beratername => { type => 'varchar', length => 9 }, + mandantennr => { type => 'varchar', length => 5 }, + dfvkz => { type => 'varchar', length => 2 }, + datentraegernr => { type => 'varchar', length => 3 }, + abrechnungsnr => { type => 'varchar', length => 6 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + id => { type => 'serial', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index ce06162d4..c11777437 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -6,117 +6,117 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'defaults', +__PACKAGE__->meta->table('defaults'); - columns => [ - inventory_accno_id => { type => 'integer' }, - income_accno_id => { type => 'integer' }, - expense_accno_id => { type => 'integer' }, - fxgain_accno_id => { type => 'integer' }, - fxloss_accno_id => { type => 'integer' }, - invnumber => { type => 'text' }, - sonumber => { type => 'text' }, - weightunit => { type => 'varchar', length => 5 }, - businessnumber => { type => 'text' }, - version => { type => 'varchar', length => 8 }, - closedto => { type => 'date' }, - revtrans => { type => 'boolean', default => 'false' }, - ponumber => { type => 'text' }, - sqnumber => { type => 'text' }, - rfqnumber => { type => 'text' }, - customernumber => { type => 'text' }, - vendornumber => { type => 'text' }, - audittrail => { type => 'boolean', default => 'false' }, - articlenumber => { type => 'text' }, - servicenumber => { type => 'text' }, - coa => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - rmanumber => { type => 'text' }, - cnnumber => { type => 'text' }, - dunning_ar_amount_fee => { type => 'integer' }, - dunning_ar_amount_interest => { type => 'integer' }, - dunning_ar => { type => 'integer' }, - pdonumber => { type => 'text' }, - sdonumber => { type => 'text' }, - ar_paid_accno_id => { type => 'integer' }, - id => { type => 'serial', not_null => 1 }, - language_id => { type => 'integer' }, - accounting_method => { type => 'text' }, - inventory_system => { type => 'text' }, - profit_determination => { type => 'text' }, - datev_check_on_sales_invoice => { type => 'boolean', default => 'true' }, - datev_check_on_purchase_invoice => { type => 'boolean', default => 'true' }, - datev_check_on_ar_transaction => { type => 'boolean', default => 'true' }, - datev_check_on_ap_transaction => { type => 'boolean', default => 'true' }, - datev_check_on_gl_transaction => { type => 'boolean', default => 'true' }, - payments_changeable => { type => 'integer', default => '0', not_null => 1 }, - is_changeable => { type => 'integer', default => 2, not_null => 1 }, - ir_changeable => { type => 'integer', default => 2, not_null => 1 }, - ar_changeable => { type => 'integer', default => 2, not_null => 1 }, - ap_changeable => { type => 'integer', default => 2, not_null => 1 }, - gl_changeable => { type => 'integer', default => 2, not_null => 1 }, - show_bestbefore => { type => 'boolean', default => 'false' }, - sales_order_show_delete => { type => 'boolean', default => 'true' }, - purchase_order_show_delete => { type => 'boolean', default => 'true' }, - sales_delivery_order_show_delete => { type => 'boolean', default => 'true' }, - purchase_delivery_order_show_delete => { type => 'boolean', default => 'true' }, - is_show_mark_as_paid => { type => 'boolean', default => 'true' }, - ir_show_mark_as_paid => { type => 'boolean', default => 'true' }, - ar_show_mark_as_paid => { type => 'boolean', default => 'true' }, - ap_show_mark_as_paid => { type => 'boolean', default => 'true' }, - max_future_booking_interval => { type => 'integer', default => 360 }, - assemblynumber => { type => 'text' }, - warehouse_id => { type => 'integer' }, - bin_id => { type => 'integer' }, - company => { type => 'text' }, - address => { type => 'text' }, - taxnumber => { type => 'text' }, - co_ustid => { type => 'text' }, - duns => { type => 'text' }, - sepa_creditor_id => { type => 'text' }, - templates => { type => 'text' }, - show_weight => { type => 'boolean', default => 'false', not_null => 1 }, - transfer_default => { type => 'boolean', default => 'true' }, - transfer_default_use_master_default_bin => { type => 'boolean', default => 'false' }, - transfer_default_ignore_onhand => { type => 'boolean', default => 'false' }, - warehouse_id_ignore_onhand => { type => 'integer' }, - bin_id_ignore_onhand => { type => 'integer' }, - currency_id => { type => 'integer', not_null => 1 }, - ], +__PACKAGE__->meta->columns( + inventory_accno_id => { type => 'integer' }, + income_accno_id => { type => 'integer' }, + expense_accno_id => { type => 'integer' }, + fxgain_accno_id => { type => 'integer' }, + fxloss_accno_id => { type => 'integer' }, + invnumber => { type => 'text' }, + sonumber => { type => 'text' }, + weightunit => { type => 'varchar', length => 5 }, + businessnumber => { type => 'text' }, + version => { type => 'varchar', length => 8 }, + closedto => { type => 'date' }, + revtrans => { type => 'boolean', default => 'false' }, + ponumber => { type => 'text' }, + sqnumber => { type => 'text' }, + rfqnumber => { type => 'text' }, + customernumber => { type => 'text' }, + vendornumber => { type => 'text' }, + audittrail => { type => 'boolean', default => 'false' }, + articlenumber => { type => 'text' }, + servicenumber => { type => 'text' }, + coa => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + rmanumber => { type => 'text' }, + cnnumber => { type => 'text' }, + dunning_ar_amount_fee => { type => 'integer' }, + dunning_ar_amount_interest => { type => 'integer' }, + dunning_ar => { type => 'integer' }, + pdonumber => { type => 'text' }, + sdonumber => { type => 'text' }, + id => { type => 'serial', not_null => 1 }, + ar_paid_accno_id => { type => 'integer' }, + language_id => { type => 'integer' }, + accounting_method => { type => 'text' }, + inventory_system => { type => 'text' }, + profit_determination => { type => 'text' }, + datev_check_on_sales_invoice => { type => 'boolean', default => 'true' }, + datev_check_on_purchase_invoice => { type => 'boolean', default => 'true' }, + datev_check_on_ar_transaction => { type => 'boolean', default => 'true' }, + datev_check_on_ap_transaction => { type => 'boolean', default => 'true' }, + datev_check_on_gl_transaction => { type => 'boolean', default => 'true' }, + payments_changeable => { type => 'integer', default => '0', not_null => 1 }, + is_changeable => { type => 'integer', default => 2, not_null => 1 }, + ir_changeable => { type => 'integer', default => 2, not_null => 1 }, + ar_changeable => { type => 'integer', default => 2, not_null => 1 }, + ap_changeable => { type => 'integer', default => 2, not_null => 1 }, + gl_changeable => { type => 'integer', default => 2, not_null => 1 }, + show_bestbefore => { type => 'boolean', default => 'false' }, + sales_order_show_delete => { type => 'boolean', default => 'true' }, + purchase_order_show_delete => { type => 'boolean', default => 'true' }, + sales_delivery_order_show_delete => { type => 'boolean', default => 'true' }, + purchase_delivery_order_show_delete => { type => 'boolean', default => 'true' }, + is_show_mark_as_paid => { type => 'boolean', default => 'true' }, + ir_show_mark_as_paid => { type => 'boolean', default => 'true' }, + ar_show_mark_as_paid => { type => 'boolean', default => 'true' }, + ap_show_mark_as_paid => { type => 'boolean', default => 'true' }, + assemblynumber => { type => 'text' }, + currency_id => { type => 'integer', not_null => 1 }, + warehouse_id => { type => 'integer' }, + bin_id => { type => 'integer' }, + show_weight => { type => 'boolean', default => 'false', not_null => 1 }, + transfer_default => { type => 'boolean', default => 'true' }, + transfer_default_use_master_default_bin => { type => 'boolean', default => 'false' }, + transfer_default_ignore_onhand => { type => 'boolean', default => 'false' }, + warehouse_id_ignore_onhand => { type => 'integer' }, + bin_id_ignore_onhand => { type => 'integer' }, + company => { type => 'text' }, + address => { type => 'text' }, + taxnumber => { type => 'text' }, + co_ustid => { type => 'text' }, + duns => { type => 'text' }, + sepa_creditor_id => { type => 'text' }, + templates => { type => 'text' }, + max_future_booking_interval => { type => 'integer', default => 360 }, +); - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - allow_inline_column_values => 1, +__PACKAGE__->meta->allow_inline_column_values(1); - foreign_keys => [ - bin => { - class => 'SL::DB::Bin', - key_columns => { bin_id => 'id' }, - }, +__PACKAGE__->meta->foreign_keys( + bin => { + class => 'SL::DB::Bin', + key_columns => { bin_id => 'id' }, + }, - bin_obj => { - class => 'SL::DB::Bin', - key_columns => { bin_id_ignore_onhand => 'id' }, - }, + bin_obj => { + class => 'SL::DB::Bin', + key_columns => { bin_id_ignore_onhand => 'id' }, + }, - currency => { - class => 'SL::DB::Currency', - key_columns => { currency_id => 'id' }, - }, + currency => { + class => 'SL::DB::Currency', + key_columns => { currency_id => 'id' }, + }, - warehouse => { - class => 'SL::DB::Warehouse', - key_columns => { warehouse_id => 'id' }, - }, + warehouse => { + class => 'SL::DB::Warehouse', + key_columns => { warehouse_id => 'id' }, + }, - warehouse_obj => { - class => 'SL::DB::Warehouse', - key_columns => { warehouse_id_ignore_onhand => 'id' }, - }, - ], + warehouse_obj => { + class => 'SL::DB::Warehouse', + key_columns => { warehouse_id_ignore_onhand => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/DeliveryOrder.pm b/SL/DB/MetaSetup/DeliveryOrder.pm index 86cdc6406..0877f90d0 100644 --- a/SL/DB/MetaSetup/DeliveryOrder.pm +++ b/SL/DB/MetaSetup/DeliveryOrder.pm @@ -6,98 +6,73 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'delivery_orders', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - donumber => { type => 'text', not_null => 1 }, - ordnumber => { type => 'text' }, - transdate => { type => 'date', default => 'now()' }, - vendor_id => { type => 'integer' }, - customer_id => { type => 'integer' }, - reqdate => { type => 'date' }, - shippingpoint => { type => 'text' }, - notes => { type => 'text' }, - intnotes => { type => 'text' }, - employee_id => { type => 'integer' }, - closed => { type => 'boolean', default => 'false' }, - delivered => { type => 'boolean', default => 'false' }, - cusordnumber => { type => 'text' }, - oreqnumber => { type => 'text' }, - department_id => { type => 'integer' }, - shipvia => { type => 'text' }, - cp_id => { type => 'integer' }, - language_id => { type => 'integer' }, - shipto_id => { type => 'integer' }, - globalproject_id => { type => 'integer' }, - salesman_id => { type => 'integer' }, - transaction_description => { type => 'text' }, - is_sales => { type => 'boolean' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - taxzone_id => { type => 'integer' }, - taxincluded => { type => 'boolean' }, - terms => { type => 'integer' }, - currency_id => { type => 'integer', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - contact => { - class => 'SL::DB::Contact', - key_columns => { cp_id => 'cp_id' }, - }, - - currency => { - class => 'SL::DB::Currency', - key_columns => { currency_id => 'id' }, - }, - - customer => { - class => 'SL::DB::Customer', - key_columns => { customer_id => 'id' }, - }, +__PACKAGE__->meta->table('delivery_orders'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + donumber => { type => 'text', not_null => 1 }, + ordnumber => { type => 'text' }, + transdate => { type => 'date', default => 'now()' }, + vendor_id => { type => 'integer' }, + customer_id => { type => 'integer' }, + reqdate => { type => 'date' }, + shippingpoint => { type => 'text' }, + notes => { type => 'text' }, + intnotes => { type => 'text' }, + employee_id => { type => 'integer' }, + closed => { type => 'boolean', default => 'false' }, + delivered => { type => 'boolean', default => 'false' }, + cusordnumber => { type => 'text' }, + oreqnumber => { type => 'text' }, + department_id => { type => 'integer' }, + shipvia => { type => 'text' }, + cp_id => { type => 'integer' }, + language_id => { type => 'integer' }, + shipto_id => { type => 'integer' }, + globalproject_id => { type => 'integer' }, + salesman_id => { type => 'integer' }, + transaction_description => { type => 'text' }, + is_sales => { type => 'boolean' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + taxzone_id => { type => 'integer' }, + taxincluded => { type => 'boolean' }, + terms => { type => 'integer' }, + currency_id => { type => 'integer', not_null => 1 }, +); - department => { - class => 'SL::DB::Department', - key_columns => { department_id => 'id' }, - }, +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - employee => { - class => 'SL::DB::Employee', - key_columns => { employee_id => 'id' }, - }, +__PACKAGE__->meta->allow_inline_column_values(1); - globalproject => { - class => 'SL::DB::Project', - key_columns => { globalproject_id => 'id' }, - }, +__PACKAGE__->meta->foreign_keys( + contact => { + class => 'SL::DB::Contact', + key_columns => { cp_id => 'cp_id' }, + }, - language => { - class => 'SL::DB::Language', - key_columns => { language_id => 'id' }, - }, + currency => { + class => 'SL::DB::Currency', + key_columns => { currency_id => 'id' }, + }, - salesman => { - class => 'SL::DB::Employee', - key_columns => { salesman_id => 'id' }, - }, + customer => { + class => 'SL::DB::Customer', + key_columns => { customer_id => 'id' }, + }, - shipto => { - class => 'SL::DB::Shipto', - key_columns => { shipto_id => 'shipto_id' }, - }, + globalproject => { + class => 'SL::DB::Project', + key_columns => { globalproject_id => 'id' }, + }, - vendor => { - class => 'SL::DB::Vendor', - key_columns => { vendor_id => 'id' }, - }, - ], + vendor => { + class => 'SL::DB::Vendor', + key_columns => { vendor_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/DeliveryOrderItem.pm b/SL/DB/MetaSetup/DeliveryOrderItem.pm index d5aaf3c79..c92c98a57 100644 --- a/SL/DB/MetaSetup/DeliveryOrderItem.pm +++ b/SL/DB/MetaSetup/DeliveryOrderItem.pm @@ -6,66 +6,56 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'delivery_order_items', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'delivery_order_items_id' }, - delivery_order_id => { type => 'integer', not_null => 1 }, - parts_id => { type => 'integer', not_null => 1 }, - description => { type => 'text' }, - qty => { type => 'numeric', precision => 5, scale => 25 }, - sellprice => { type => 'numeric', precision => 5, scale => 15 }, - discount => { type => 'float', precision => 4 }, - project_id => { type => 'integer' }, - reqdate => { type => 'date' }, - serialnumber => { type => 'text' }, - ordnumber => { type => 'text' }, - transdate => { type => 'text' }, - cusordnumber => { type => 'text' }, - unit => { type => 'varchar', length => 20 }, - base_qty => { type => 'float', precision => 4 }, - longdescription => { type => 'text' }, - lastcost => { type => 'numeric', precision => 5, scale => 15 }, - price_factor_id => { type => 'integer' }, - price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 }, - marge_price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - pricegroup_id => { type => 'integer' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->table('delivery_order_items'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'delivery_order_items_id' }, + delivery_order_id => { type => 'integer', not_null => 1 }, + parts_id => { type => 'integer', not_null => 1 }, + description => { type => 'text' }, + qty => { type => 'numeric', precision => 5, scale => 25 }, + sellprice => { type => 'numeric', precision => 5, scale => 15 }, + discount => { type => 'float', precision => 4 }, + project_id => { type => 'integer' }, + reqdate => { type => 'date' }, + serialnumber => { type => 'text' }, + ordnumber => { type => 'text' }, + transdate => { type => 'text' }, + cusordnumber => { type => 'text' }, + unit => { type => 'varchar', length => 20 }, + base_qty => { type => 'float', precision => 4 }, + longdescription => { type => 'text' }, + lastcost => { type => 'numeric', precision => 5, scale => 15 }, + price_factor_id => { type => 'integer' }, + price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 }, + marge_price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + pricegroup_id => { type => 'integer' }, +); - foreign_keys => [ - delivery_order => { - class => 'SL::DB::DeliveryOrder', - key_columns => { delivery_order_id => 'id' }, - }, +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - part => { - class => 'SL::DB::Part', - key_columns => { parts_id => 'id' }, - }, +__PACKAGE__->meta->allow_inline_column_values(1); - price_factor_obj => { - class => 'SL::DB::PriceFactor', - key_columns => { price_factor_id => 'id' }, - }, +__PACKAGE__->meta->foreign_keys( + delivery_order => { + class => 'SL::DB::DeliveryOrder', + key_columns => { delivery_order_id => 'id' }, + }, - pricegroup => { - class => 'SL::DB::Pricegroup', - key_columns => { pricegroup_id => 'id' }, - }, + parts => { + class => 'SL::DB::Part', + key_columns => { parts_id => 'id' }, + }, - project => { - class => 'SL::DB::Project', - key_columns => { project_id => 'id' }, - }, - ], + project => { + class => 'SL::DB::Project', + key_columns => { project_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/DeliveryOrderItemsStock.pm b/SL/DB/MetaSetup/DeliveryOrderItemsStock.pm index 99a2925d7..52e78e8ec 100644 --- a/SL/DB/MetaSetup/DeliveryOrderItemsStock.pm +++ b/SL/DB/MetaSetup/DeliveryOrderItemsStock.pm @@ -6,43 +6,43 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'delivery_order_items_stock', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - delivery_order_item_id => { type => 'integer', not_null => 1 }, - qty => { type => 'numeric', not_null => 1, precision => 5, scale => 15 }, - unit => { type => 'varchar', length => 20, not_null => 1 }, - warehouse_id => { type => 'integer', not_null => 1 }, - bin_id => { type => 'integer', not_null => 1 }, - chargenumber => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - bestbefore => { type => 'date' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - bin => { - class => 'SL::DB::Bin', - key_columns => { bin_id => 'id' }, - }, - - delivery_order_item => { - class => 'SL::DB::DeliveryOrderItem', - key_columns => { delivery_order_item_id => 'id' }, - }, - - warehouse => { - class => 'SL::DB::Warehouse', - key_columns => { warehouse_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('delivery_order_items_stock'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + delivery_order_item_id => { type => 'integer', not_null => 1 }, + qty => { type => 'numeric', not_null => 1, precision => 5, scale => 15 }, + unit => { type => 'varchar', length => 20, not_null => 1 }, + warehouse_id => { type => 'integer', not_null => 1 }, + bin_id => { type => 'integer', not_null => 1 }, + chargenumber => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + bestbefore => { type => 'date' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + bin => { + class => 'SL::DB::Bin', + key_columns => { bin_id => 'id' }, + }, + + delivery_order_item => { + class => 'SL::DB::DeliveryOrderItem', + key_columns => { delivery_order_item_id => 'id' }, + }, + + warehouse => { + class => 'SL::DB::Warehouse', + key_columns => { warehouse_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Department.pm b/SL/DB/MetaSetup/Department.pm index 921601460..527234dab 100644 --- a/SL/DB/MetaSetup/Department.pm +++ b/SL/DB/MetaSetup/Department.pm @@ -6,20 +6,34 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'department', +__PACKAGE__->meta->table('department'); - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - description => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - ], +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + description => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->allow_inline_column_values(1); - allow_inline_column_values => 1, +__PACKAGE__->meta->relationships( + ap => { + class => 'SL::DB::PurchaseInvoice', + column_map => { id => 'department_id' }, + type => 'one to many', + }, + + ar => { + class => 'SL::DB::Invoice', + column_map => { id => 'department_id' }, + type => 'one to many', + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Draft.pm b/SL/DB/MetaSetup/Draft.pm index 1a8ffc680..374c19e9c 100644 --- a/SL/DB/MetaSetup/Draft.pm +++ b/SL/DB/MetaSetup/Draft.pm @@ -6,30 +6,23 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'drafts', - - columns => [ - id => { type => 'varchar', length => 50, not_null => 1 }, - module => { type => 'varchar', length => 50, not_null => 1 }, - submodule => { type => 'varchar', length => 50, not_null => 1 }, - description => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - form => { type => 'text' }, - employee_id => { type => 'integer' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - employee => { - class => 'SL::DB::Employee', - key_columns => { employee_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('drafts'); + +__PACKAGE__->meta->columns( + id => { type => 'varchar', length => 50, not_null => 1 }, + module => { type => 'varchar', length => 50, not_null => 1 }, + submodule => { type => 'varchar', length => 50, not_null => 1 }, + description => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + form => { type => 'text' }, + employee_id => { type => 'integer' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Dunning.pm b/SL/DB/MetaSetup/Dunning.pm index bc4ba879e..019662bc4 100644 --- a/SL/DB/MetaSetup/Dunning.pm +++ b/SL/DB/MetaSetup/Dunning.pm @@ -6,40 +6,35 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'dunning', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - trans_id => { type => 'integer' }, - dunning_id => { type => 'integer' }, - dunning_level => { type => 'integer' }, - transdate => { type => 'date' }, - duedate => { type => 'date' }, - fee => { type => 'numeric', precision => 5, scale => 15 }, - interest => { type => 'numeric', precision => 5, scale => 15 }, - dunning_config_id => { type => 'integer' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - fee_interest_ar_id => { type => 'integer' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - dunning_config => { - class => 'SL::DB::DunningConfig', - key_columns => { dunning_config_id => 'id' }, - }, - - fee_interest_ar => { - class => 'SL::DB::Invoice', - key_columns => { fee_interest_ar_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('dunning'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + trans_id => { type => 'integer' }, + dunning_id => { type => 'integer' }, + dunning_level => { type => 'integer' }, + transdate => { type => 'date' }, + duedate => { type => 'date' }, + fee => { type => 'numeric', precision => 5, scale => 15 }, + interest => { type => 'numeric', precision => 5, scale => 15 }, + dunning_config_id => { type => 'integer' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + fee_interest_ar_id => { type => 'integer' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + fee_interest_ar => { + class => 'SL::DB::Invoice', + key_columns => { fee_interest_ar_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/DunningConfig.pm b/SL/DB/MetaSetup/DunningConfig.pm index c6702657e..602ae8ea5 100644 --- a/SL/DB/MetaSetup/DunningConfig.pm +++ b/SL/DB/MetaSetup/DunningConfig.pm @@ -6,29 +6,43 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'dunning_config', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - dunning_level => { type => 'integer' }, - dunning_description => { type => 'text' }, - active => { type => 'boolean' }, - auto => { type => 'boolean' }, - email => { type => 'boolean' }, - terms => { type => 'integer' }, - payment_terms => { type => 'integer' }, - fee => { type => 'numeric', precision => 5, scale => 15 }, - interest_rate => { type => 'numeric', precision => 5, scale => 15 }, - email_body => { type => 'text' }, - email_subject => { type => 'text' }, - email_attachment => { type => 'boolean' }, - template => { type => 'text' }, - create_invoices_for_fees => { type => 'boolean', default => 'true' }, - ], - - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->table('dunning_config'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + dunning_level => { type => 'integer' }, + dunning_description => { type => 'text' }, + active => { type => 'boolean' }, + auto => { type => 'boolean' }, + email => { type => 'boolean' }, + terms => { type => 'integer' }, + payment_terms => { type => 'integer' }, + fee => { type => 'numeric', precision => 5, scale => 15 }, + interest_rate => { type => 'numeric', precision => 5, scale => 15 }, + email_body => { type => 'text' }, + email_subject => { type => 'text' }, + email_attachment => { type => 'boolean' }, + template => { type => 'text' }, + create_invoices_for_fees => { type => 'boolean', default => 'true' }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->relationships( + ar => { + class => 'SL::DB::Invoice', + column_map => { id => 'dunning_config_id' }, + type => 'one to many', + }, + + dunning => { + class => 'SL::DB::Dunning', + column_map => { id => 'dunning_config_id' }, + type => 'one to many', + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Employee.pm b/SL/DB/MetaSetup/Employee.pm index b7b06be86..63b0f1a40 100644 --- a/SL/DB/MetaSetup/Employee.pm +++ b/SL/DB/MetaSetup/Employee.pm @@ -6,34 +6,60 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'employee', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - login => { type => 'text' }, - startdate => { type => 'date', default => 'now' }, - enddate => { type => 'date' }, - notes => { type => 'text' }, - sales => { type => 'boolean', default => 'true' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - name => { type => 'text' }, - addr1 => { type => 'text' }, - addr2 => { type => 'text' }, - addr3 => { type => 'text' }, - addr4 => { type => 'text' }, - homephone => { type => 'text' }, - workphone => { type => 'text' }, - deleted => { type => 'boolean', default => 'false' }, - ], - - primary_key_columns => [ 'id' ], - - unique_key => [ 'login' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->table('employee'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + login => { type => 'text' }, + startdate => { type => 'date', default => 'now' }, + enddate => { type => 'date' }, + notes => { type => 'text' }, + sales => { type => 'boolean', default => 'true' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + name => { type => 'text' }, + addr1 => { type => 'text' }, + addr2 => { type => 'text' }, + addr3 => { type => 'text' }, + addr4 => { type => 'text' }, + homephone => { type => 'text' }, + workphone => { type => 'text' }, + deleted => { type => 'boolean', default => 'false' }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->unique_keys([ 'login' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->relationships( + ap => { + class => 'SL::DB::PurchaseInvoice', + column_map => { id => 'employee_id' }, + type => 'one to many', + }, + + ar => { + class => 'SL::DB::Invoice', + column_map => { id => 'employee_id' }, + type => 'one to many', + }, + + ar_objs => { + class => 'SL::DB::Invoice', + column_map => { id => 'salesman_id' }, + type => 'one to many', + }, + + drafts => { + class => 'SL::DB::Draft', + column_map => { id => 'employee_id' }, + type => 'one to many', + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Exchangerate.pm b/SL/DB/MetaSetup/Exchangerate.pm index ddd09438b..43df5dfd6 100644 --- a/SL/DB/MetaSetup/Exchangerate.pm +++ b/SL/DB/MetaSetup/Exchangerate.pm @@ -6,30 +6,30 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'exchangerate', - - columns => [ - transdate => { type => 'date' }, - buy => { type => 'numeric', precision => 5, scale => 15 }, - sell => { type => 'numeric', precision => 5, scale => 15 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - id => { type => 'serial', not_null => 1 }, - currency_id => { type => 'integer', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - currency => { - class => 'SL::DB::Currency', - key_columns => { currency_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('exchangerate'); + +__PACKAGE__->meta->columns( + transdate => { type => 'date' }, + buy => { type => 'numeric', precision => 5, scale => 15 }, + sell => { type => 'numeric', precision => 5, scale => 15 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + id => { type => 'serial', not_null => 1 }, + currency_id => { type => 'integer', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + currency => { + class => 'SL::DB::Currency', + key_columns => { currency_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Finanzamt.pm b/SL/DB/MetaSetup/Finanzamt.pm index fa2291938..6eceffabb 100644 --- a/SL/DB/MetaSetup/Finanzamt.pm +++ b/SL/DB/MetaSetup/Finanzamt.pm @@ -6,35 +6,35 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'finanzamt', +__PACKAGE__->meta->table('finanzamt'); - columns => [ - fa_land_nr => { type => 'text' }, - fa_bufa_nr => { type => 'text' }, - fa_name => { type => 'text' }, - fa_strasse => { type => 'text' }, - fa_plz => { type => 'text' }, - fa_ort => { type => 'text' }, - fa_telefon => { type => 'text' }, - fa_fax => { type => 'text' }, - fa_plz_grosskunden => { type => 'text' }, - fa_plz_postfach => { type => 'text' }, - fa_postfach => { type => 'text' }, - fa_blz_1 => { type => 'text' }, - fa_kontonummer_1 => { type => 'text' }, - fa_bankbezeichnung_1 => { type => 'text' }, - fa_blz_2 => { type => 'text' }, - fa_kontonummer_2 => { type => 'text' }, - fa_bankbezeichnung_2 => { type => 'text' }, - fa_oeffnungszeiten => { type => 'text' }, - fa_email => { type => 'text' }, - fa_internet => { type => 'text' }, - id => { type => 'serial', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->columns( + fa_land_nr => { type => 'text' }, + fa_bufa_nr => { type => 'text' }, + fa_name => { type => 'text' }, + fa_strasse => { type => 'text' }, + fa_plz => { type => 'text' }, + fa_ort => { type => 'text' }, + fa_telefon => { type => 'text' }, + fa_fax => { type => 'text' }, + fa_plz_grosskunden => { type => 'text' }, + fa_plz_postfach => { type => 'text' }, + fa_postfach => { type => 'text' }, + fa_blz_1 => { type => 'text' }, + fa_kontonummer_1 => { type => 'text' }, + fa_bankbezeichnung_1 => { type => 'text' }, + fa_blz_2 => { type => 'text' }, + fa_kontonummer_2 => { type => 'text' }, + fa_bankbezeichnung_2 => { type => 'text' }, + fa_oeffnungszeiten => { type => 'text' }, + fa_email => { type => 'text' }, + fa_internet => { type => 'text' }, + id => { type => 'serial', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/FollowUp.pm b/SL/DB/MetaSetup/FollowUp.pm index 3e83f0e35..b102f249c 100644 --- a/SL/DB/MetaSetup/FollowUp.pm +++ b/SL/DB/MetaSetup/FollowUp.pm @@ -6,41 +6,44 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'follow_ups', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'follow_up_id' }, - follow_up_date => { type => 'date', not_null => 1 }, - created_for_user => { type => 'integer', not_null => 1 }, - done => { type => 'boolean', default => 'false' }, - note_id => { type => 'integer', not_null => 1 }, - created_by => { type => 'integer', not_null => 1 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - employee => { - class => 'SL::DB::Employee', - key_columns => { created_for_user => 'id' }, - }, - - employee_obj => { - class => 'SL::DB::Employee', - key_columns => { created_by => 'id' }, - }, - - note => { - class => 'SL::DB::Note', - key_columns => { note_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('follow_ups'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'follow_up_id' }, + follow_up_date => { type => 'date', not_null => 1 }, + created_for_user => { type => 'integer', not_null => 1 }, + done => { type => 'boolean', default => 'false' }, + note_id => { type => 'integer', not_null => 1 }, + created_by => { type => 'integer', not_null => 1 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + employee => { + class => 'SL::DB::Employee', + key_columns => { created_for_user => 'id' }, + }, + + employee_obj => { + class => 'SL::DB::Employee', + key_columns => { created_by => 'id' }, + }, +); + +__PACKAGE__->meta->relationships( + follow_up_links => { + class => 'SL::DB::FollowUpLink', + column_map => { id => 'follow_up_id' }, + type => 'one to many', + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/FollowUpAccess.pm b/SL/DB/MetaSetup/FollowUpAccess.pm index 0a26083f8..55c6f5f14 100644 --- a/SL/DB/MetaSetup/FollowUpAccess.pm +++ b/SL/DB/MetaSetup/FollowUpAccess.pm @@ -6,29 +6,29 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'follow_up_access', - - columns => [ - who => { type => 'integer', not_null => 1 }, - what => { type => 'integer', not_null => 1 }, - id => { type => 'serial', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - foreign_keys => [ - employee => { - class => 'SL::DB::Employee', - key_columns => { who => 'id' }, - }, - - employee_obj => { - class => 'SL::DB::Employee', - key_columns => { what => 'id' }, - }, - ], +__PACKAGE__->meta->table('follow_up_access'); + +__PACKAGE__->meta->columns( + who => { type => 'integer', not_null => 1 }, + what => { type => 'integer', not_null => 1 }, + id => { type => 'serial', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->foreign_keys( + employee => { + class => 'SL::DB::Employee', + key_columns => { who => 'id' }, + }, + + employee_obj => { + class => 'SL::DB::Employee', + key_columns => { what => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/FollowUpLink.pm b/SL/DB/MetaSetup/FollowUpLink.pm index 7bfec7ddb..00e25ecbe 100644 --- a/SL/DB/MetaSetup/FollowUpLink.pm +++ b/SL/DB/MetaSetup/FollowUpLink.pm @@ -6,30 +6,23 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'follow_up_links', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'follow_up_link_id' }, - follow_up_id => { type => 'integer', not_null => 1 }, - trans_id => { type => 'integer', not_null => 1 }, - trans_type => { type => 'text', not_null => 1 }, - trans_info => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - follow_up => { - class => 'SL::DB::FollowUp', - key_columns => { follow_up_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('follow_up_links'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'follow_up_link_id' }, + follow_up_id => { type => 'integer', not_null => 1 }, + trans_id => { type => 'integer', not_null => 1 }, + trans_type => { type => 'text', not_null => 1 }, + trans_info => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/GLTransaction.pm b/SL/DB/MetaSetup/GLTransaction.pm index da1990162..c8019ebcf 100644 --- a/SL/DB/MetaSetup/GLTransaction.pm +++ b/SL/DB/MetaSetup/GLTransaction.pm @@ -6,44 +6,52 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'gl', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'glid' }, - reference => { type => 'text' }, - description => { type => 'text' }, - transdate => { type => 'date', default => 'now' }, - gldate => { type => 'date', default => 'now' }, - employee_id => { type => 'integer' }, - notes => { type => 'text' }, - department_id => { type => 'integer' }, - taxincluded => { type => 'boolean' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - type => { type => 'text' }, - storno => { type => 'boolean', default => 'false' }, - storno_id => { type => 'integer' }, - ob_transaction => { type => 'boolean' }, - cb_transaction => { type => 'boolean' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - department => { - class => 'SL::DB::Department', - key_columns => { department_id => 'id' }, - }, - - storno_obj => { - class => 'SL::DB::GLTransaction', - key_columns => { storno_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('gl'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'glid' }, + reference => { type => 'text' }, + description => { type => 'text' }, + transdate => { type => 'date', default => 'now' }, + gldate => { type => 'date', default => 'now' }, + employee_id => { type => 'integer' }, + notes => { type => 'text' }, + department_id => { type => 'integer' }, + taxincluded => { type => 'boolean' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + type => { type => 'text' }, + storno => { type => 'boolean', default => 'false' }, + storno_id => { type => 'integer' }, + ob_transaction => { type => 'boolean' }, + cb_transaction => { type => 'boolean' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + department => { + class => 'SL::DB::Department', + key_columns => { department_id => 'id' }, + }, + + storno_obj => { + class => 'SL::DB::GLTransaction', + key_columns => { storno_id => 'id' }, + }, +); + +__PACKAGE__->meta->relationships( + gl => { + class => 'SL::DB::GLTransaction', + column_map => { id => 'storno_id' }, + type => 'one to many', + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/GenericTranslation.pm b/SL/DB/MetaSetup/GenericTranslation.pm index 452222406..46a19caf5 100644 --- a/SL/DB/MetaSetup/GenericTranslation.pm +++ b/SL/DB/MetaSetup/GenericTranslation.pm @@ -6,26 +6,19 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'generic_translations', +__PACKAGE__->meta->table('generic_translations'); - columns => [ - id => { type => 'serial', not_null => 1 }, - language_id => { type => 'integer' }, - translation_type => { type => 'varchar', length => 100, not_null => 1 }, - translation_id => { type => 'integer' }, - translation => { type => 'text' }, - ], +__PACKAGE__->meta->columns( + id => { type => 'serial', not_null => 1 }, + language_id => { type => 'integer' }, + translation_type => { type => 'varchar', length => 100, not_null => 1 }, + translation_id => { type => 'integer' }, + translation => { type => 'text' }, +); - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - foreign_keys => [ - language => { - class => 'SL::DB::Language', - key_columns => { language_id => 'id' }, - }, - ], -); +# __PACKAGE__->meta->initialize; 1; ; diff --git a/SL/DB/MetaSetup/History.pm b/SL/DB/MetaSetup/History.pm index 1146f8ff5..124867936 100644 --- a/SL/DB/MetaSetup/History.pm +++ b/SL/DB/MetaSetup/History.pm @@ -6,30 +6,30 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'history_erp', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - trans_id => { type => 'integer' }, - employee_id => { type => 'integer' }, - addition => { type => 'text' }, - what_done => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - snumbers => { type => 'text' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - employee => { - class => 'SL::DB::Employee', - key_columns => { employee_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('history_erp'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + trans_id => { type => 'integer' }, + employee_id => { type => 'integer' }, + addition => { type => 'text' }, + what_done => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + snumbers => { type => 'text' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + employee => { + class => 'SL::DB::Employee', + key_columns => { employee_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Inventory.pm b/SL/DB/MetaSetup/Inventory.pm index e2093efe8..68c5b3905 100644 --- a/SL/DB/MetaSetup/Inventory.pm +++ b/SL/DB/MetaSetup/Inventory.pm @@ -6,65 +6,65 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'inventory', +__PACKAGE__->meta->table('inventory'); - columns => [ - warehouse_id => { type => 'integer', not_null => 1 }, - parts_id => { type => 'integer', not_null => 1 }, - oe_id => { type => 'integer' }, - orderitems_id => { type => 'integer' }, - shippingdate => { type => 'date' }, - employee_id => { type => 'integer', not_null => 1 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - bin_id => { type => 'integer', not_null => 1 }, - qty => { type => 'numeric', precision => 5, scale => 25 }, - trans_id => { type => 'integer', not_null => 1 }, - trans_type_id => { type => 'integer', not_null => 1 }, - project_id => { type => 'integer' }, - chargenumber => { type => 'text', default => '', not_null => 1 }, - comment => { type => 'text' }, - bestbefore => { type => 'date' }, - id => { type => 'serial', not_null => 1 }, - ], +__PACKAGE__->meta->columns( + warehouse_id => { type => 'integer', not_null => 1 }, + parts_id => { type => 'integer', not_null => 1 }, + oe_id => { type => 'integer' }, + orderitems_id => { type => 'integer' }, + shippingdate => { type => 'date' }, + employee_id => { type => 'integer', not_null => 1 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + bin_id => { type => 'integer', not_null => 1 }, + qty => { type => 'numeric', precision => 5, scale => 25 }, + trans_id => { type => 'integer', not_null => 1 }, + trans_type_id => { type => 'integer', not_null => 1 }, + project_id => { type => 'integer' }, + chargenumber => { type => 'text', default => '', not_null => 1 }, + comment => { type => 'text' }, + bestbefore => { type => 'date' }, + id => { type => 'serial', not_null => 1 }, +); - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - allow_inline_column_values => 1, +__PACKAGE__->meta->allow_inline_column_values(1); - foreign_keys => [ - bin => { - class => 'SL::DB::Bin', - key_columns => { bin_id => 'id' }, - }, +__PACKAGE__->meta->foreign_keys( + bin => { + class => 'SL::DB::Bin', + key_columns => { bin_id => 'id' }, + }, - employee => { - class => 'SL::DB::Employee', - key_columns => { employee_id => 'id' }, - }, + employee => { + class => 'SL::DB::Employee', + key_columns => { employee_id => 'id' }, + }, - parts => { - class => 'SL::DB::Part', - key_columns => { parts_id => 'id' }, - }, + parts => { + class => 'SL::DB::Part', + key_columns => { parts_id => 'id' }, + }, - project => { - class => 'SL::DB::Project', - key_columns => { project_id => 'id' }, - }, + project => { + class => 'SL::DB::Project', + key_columns => { project_id => 'id' }, + }, - trans_type => { - class => 'SL::DB::TransferType', - key_columns => { trans_type_id => 'id' }, - }, + trans_type => { + class => 'SL::DB::TransferType', + key_columns => { trans_type_id => 'id' }, + }, - warehouse => { - class => 'SL::DB::Warehouse', - key_columns => { warehouse_id => 'id' }, - }, - ], + warehouse => { + class => 'SL::DB::Warehouse', + key_columns => { warehouse_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Invoice.pm b/SL/DB/MetaSetup/Invoice.pm index 2a0e50ee2..2dcbb9937 100644 --- a/SL/DB/MetaSetup/Invoice.pm +++ b/SL/DB/MetaSetup/Invoice.pm @@ -6,125 +6,85 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'ar', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'glid' }, - invnumber => { type => 'text', not_null => 1 }, - transdate => { type => 'date', default => 'now' }, - gldate => { type => 'date', default => 'now' }, - customer_id => { type => 'integer' }, - taxincluded => { type => 'boolean' }, - amount => { type => 'numeric', precision => 5, scale => 15 }, - netamount => { type => 'numeric', precision => 5, scale => 15 }, - paid => { type => 'numeric', precision => 5, scale => 15 }, - datepaid => { type => 'date' }, - duedate => { type => 'date' }, - deliverydate => { type => 'date' }, - invoice => { type => 'boolean', default => 'false' }, - shippingpoint => { type => 'text' }, - terms => { type => 'integer', default => '0' }, - notes => { type => 'text' }, - ordnumber => { type => 'text' }, - employee_id => { type => 'integer' }, - quonumber => { type => 'text' }, - cusordnumber => { type => 'text' }, - intnotes => { type => 'text' }, - department_id => { type => 'integer' }, - shipvia => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - cp_id => { type => 'integer' }, - language_id => { type => 'integer' }, - payment_id => { type => 'integer' }, - delivery_customer_id => { type => 'integer' }, - delivery_vendor_id => { type => 'integer' }, - storno => { type => 'boolean', default => 'false' }, - taxzone_id => { type => 'integer' }, - shipto_id => { type => 'integer' }, - type => { type => 'text' }, - dunning_config_id => { type => 'integer' }, - orddate => { type => 'date' }, - quodate => { type => 'date' }, - globalproject_id => { type => 'integer' }, - salesman_id => { type => 'integer' }, - transaction_description => { type => 'text' }, - storno_id => { type => 'integer' }, - marge_total => { type => 'numeric', precision => 5, scale => 15 }, - marge_percent => { type => 'numeric', precision => 5, scale => 15 }, - donumber => { type => 'text' }, - invnumber_for_credit_note => { type => 'text' }, - direct_debit => { type => 'boolean', default => 'false' }, - currency_id => { type => 'integer', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - contact => { - class => 'SL::DB::Contact', - key_columns => { cp_id => 'cp_id' }, - }, - - currency => { - class => 'SL::DB::Currency', - key_columns => { currency_id => 'id' }, - }, - - customer => { - class => 'SL::DB::Customer', - key_columns => { customer_id => 'id' }, - }, - - department => { - class => 'SL::DB::Department', - key_columns => { department_id => 'id' }, - }, - - dunning_config => { - class => 'SL::DB::DunningConfig', - key_columns => { dunning_config_id => 'id' }, - }, - - employee => { - class => 'SL::DB::Employee', - key_columns => { employee_id => 'id' }, - }, +__PACKAGE__->meta->table('ar'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'glid' }, + invnumber => { type => 'text', not_null => 1 }, + transdate => { type => 'date', default => 'now' }, + gldate => { type => 'date', default => 'now' }, + customer_id => { type => 'integer' }, + taxincluded => { type => 'boolean' }, + amount => { type => 'numeric', precision => 5, scale => 15 }, + netamount => { type => 'numeric', precision => 5, scale => 15 }, + paid => { type => 'numeric', precision => 5, scale => 15 }, + datepaid => { type => 'date' }, + duedate => { type => 'date' }, + deliverydate => { type => 'date' }, + invoice => { type => 'boolean', default => 'false' }, + shippingpoint => { type => 'text' }, + terms => { type => 'integer', default => '0' }, + notes => { type => 'text' }, + ordnumber => { type => 'text' }, + employee_id => { type => 'integer' }, + quonumber => { type => 'text' }, + cusordnumber => { type => 'text' }, + intnotes => { type => 'text' }, + department_id => { type => 'integer' }, + shipvia => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + cp_id => { type => 'integer' }, + language_id => { type => 'integer' }, + payment_id => { type => 'integer' }, + delivery_customer_id => { type => 'integer' }, + delivery_vendor_id => { type => 'integer' }, + storno => { type => 'boolean', default => 'false' }, + taxzone_id => { type => 'integer' }, + shipto_id => { type => 'integer' }, + type => { type => 'text' }, + dunning_config_id => { type => 'integer' }, + orddate => { type => 'date' }, + quodate => { type => 'date' }, + globalproject_id => { type => 'integer' }, + salesman_id => { type => 'integer' }, + transaction_description => { type => 'text' }, + storno_id => { type => 'integer' }, + marge_total => { type => 'numeric', precision => 5, scale => 15 }, + marge_percent => { type => 'numeric', precision => 5, scale => 15 }, + donumber => { type => 'text' }, + invnumber_for_credit_note => { type => 'text' }, + direct_debit => { type => 'boolean', default => 'false' }, + currency_id => { type => 'integer', not_null => 1 }, +); - globalproject => { - class => 'SL::DB::Project', - key_columns => { globalproject_id => 'id' }, - }, +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - language => { - class => 'SL::DB::Language', - key_columns => { language_id => 'id' }, - }, +__PACKAGE__->meta->allow_inline_column_values(1); - payment_terms => { - class => 'SL::DB::PaymentTerm', - key_columns => { payment_id => 'id' }, - }, +__PACKAGE__->meta->foreign_keys( + contact => { + class => 'SL::DB::Contact', + key_columns => { cp_id => 'cp_id' }, + }, - salesman => { - class => 'SL::DB::Employee', - key_columns => { salesman_id => 'id' }, - }, + customer => { + class => 'SL::DB::Customer', + key_columns => { customer_id => 'id' }, + }, - shipto => { - class => 'SL::DB::Shipto', - key_columns => { shipto_id => 'shipto_id' }, - }, + globalproject => { + class => 'SL::DB::Project', + key_columns => { globalproject_id => 'id' }, + }, - storno_obj => { - class => 'SL::DB::Invoice', - key_columns => { storno_id => 'id' }, - }, - ], + storno_obj => { + class => 'SL::DB::Invoice', + key_columns => { storno_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/InvoiceItem.pm b/SL/DB/MetaSetup/InvoiceItem.pm index eb5d84d2c..d02beb7d0 100644 --- a/SL/DB/MetaSetup/InvoiceItem.pm +++ b/SL/DB/MetaSetup/InvoiceItem.pm @@ -6,67 +6,57 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'invoice', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'invoiceid' }, - trans_id => { type => 'integer' }, - parts_id => { type => 'integer' }, - description => { type => 'text' }, - qty => { type => 'float', precision => 4 }, - allocated => { type => 'float', precision => 4 }, - sellprice => { type => 'numeric', precision => 5, scale => 15 }, - fxsellprice => { type => 'numeric', precision => 5, scale => 15 }, - discount => { type => 'float', precision => 4 }, - assemblyitem => { type => 'boolean', default => 'false' }, - project_id => { type => 'integer' }, - deliverydate => { type => 'date' }, - serialnumber => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - pricegroup_id => { type => 'integer' }, - ordnumber => { type => 'text' }, - transdate => { type => 'text' }, - cusordnumber => { type => 'text' }, - unit => { type => 'varchar', length => 20 }, - base_qty => { type => 'float', precision => 4 }, - subtotal => { type => 'boolean', default => 'false' }, - longdescription => { type => 'text' }, - marge_total => { type => 'numeric', precision => 5, scale => 15 }, - marge_percent => { type => 'numeric', precision => 5, scale => 15 }, - lastcost => { type => 'numeric', precision => 5, scale => 15 }, - price_factor_id => { type => 'integer' }, - price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 }, - marge_price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->table('invoice'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'invoiceid' }, + trans_id => { type => 'integer' }, + parts_id => { type => 'integer' }, + description => { type => 'text' }, + qty => { type => 'float', precision => 4 }, + allocated => { type => 'float', precision => 4 }, + sellprice => { type => 'numeric', precision => 5, scale => 15 }, + fxsellprice => { type => 'numeric', precision => 5, scale => 15 }, + discount => { type => 'float', precision => 4 }, + assemblyitem => { type => 'boolean', default => 'false' }, + project_id => { type => 'integer' }, + deliverydate => { type => 'date' }, + serialnumber => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + pricegroup_id => { type => 'integer' }, + ordnumber => { type => 'text' }, + transdate => { type => 'text' }, + cusordnumber => { type => 'text' }, + unit => { type => 'varchar', length => 20 }, + base_qty => { type => 'float', precision => 4 }, + subtotal => { type => 'boolean', default => 'false' }, + longdescription => { type => 'text' }, + marge_total => { type => 'numeric', precision => 5, scale => 15 }, + marge_percent => { type => 'numeric', precision => 5, scale => 15 }, + lastcost => { type => 'numeric', precision => 5, scale => 15 }, + price_factor_id => { type => 'integer' }, + price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 }, + marge_price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 }, +); - foreign_keys => [ - part => { - class => 'SL::DB::Part', - key_columns => { parts_id => 'id' }, - }, +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - price_factor_obj => { - class => 'SL::DB::PriceFactor', - key_columns => { price_factor_id => 'id' }, - }, +__PACKAGE__->meta->allow_inline_column_values(1); - pricegroup => { - class => 'SL::DB::Pricegroup', - key_columns => { pricegroup_id => 'id' }, - }, +__PACKAGE__->meta->foreign_keys( + parts => { + class => 'SL::DB::Part', + key_columns => { parts_id => 'id' }, + }, - project => { - class => 'SL::DB::Project', - key_columns => { project_id => 'id' }, - }, - ], + project => { + class => 'SL::DB::Project', + key_columns => { project_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Language.pm b/SL/DB/MetaSetup/Language.pm index 662abc985..f4ac9a933 100644 --- a/SL/DB/MetaSetup/Language.pm +++ b/SL/DB/MetaSetup/Language.pm @@ -6,25 +6,51 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'language', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - description => { type => 'text' }, - template_code => { type => 'text' }, - article_code => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - output_numberformat => { type => 'text' }, - output_dateformat => { type => 'text' }, - output_longdates => { type => 'boolean' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->table('language'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + description => { type => 'text' }, + template_code => { type => 'text' }, + article_code => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + output_numberformat => { type => 'text' }, + output_dateformat => { type => 'text' }, + output_longdates => { type => 'boolean' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->relationships( + ap => { + class => 'SL::DB::PurchaseInvoice', + column_map => { id => 'language_id' }, + type => 'one to many', + }, + + ar => { + class => 'SL::DB::Invoice', + column_map => { id => 'language_id' }, + type => 'one to many', + }, + + customer => { + class => 'SL::DB::Customer', + column_map => { id => 'language_id' }, + type => 'one to many', + }, + + generic_translations => { + class => 'SL::DB::GenericTranslation', + column_map => { id => 'language_id' }, + type => 'one to many', + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/MakeModel.pm b/SL/DB/MetaSetup/MakeModel.pm index c6499a593..7d724e861 100644 --- a/SL/DB/MetaSetup/MakeModel.pm +++ b/SL/DB/MetaSetup/MakeModel.pm @@ -6,25 +6,25 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'makemodel', - - columns => [ - parts_id => { type => 'integer' }, - model => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - lastcost => { type => 'numeric', precision => 5, scale => 15 }, - lastupdate => { type => 'date' }, - sortorder => { type => 'integer' }, - make => { type => 'integer' }, - id => { type => 'serial', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->table('makemodel'); + +__PACKAGE__->meta->columns( + parts_id => { type => 'integer' }, + model => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + make => { type => 'integer' }, + id => { type => 'serial', not_null => 1 }, + lastcost => { type => 'numeric', precision => 5, scale => 15 }, + lastupdate => { type => 'date' }, + sortorder => { type => 'integer' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Note.pm b/SL/DB/MetaSetup/Note.pm index a055c02ab..59085cd8c 100644 --- a/SL/DB/MetaSetup/Note.pm +++ b/SL/DB/MetaSetup/Note.pm @@ -6,31 +6,39 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'notes', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'note_id' }, - subject => { type => 'text' }, - body => { type => 'text' }, - created_by => { type => 'integer', not_null => 1 }, - trans_id => { type => 'integer' }, - trans_module => { type => 'varchar', length => 10 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - employee => { - class => 'SL::DB::Employee', - key_columns => { created_by => 'id' }, - }, - ], +__PACKAGE__->meta->table('notes'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'note_id' }, + subject => { type => 'text' }, + body => { type => 'text' }, + created_by => { type => 'integer', not_null => 1 }, + trans_id => { type => 'integer' }, + trans_module => { type => 'varchar', length => 10 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + employee => { + class => 'SL::DB::Employee', + key_columns => { created_by => 'id' }, + }, +); + +__PACKAGE__->meta->relationships( + follow_ups => { + class => 'SL::DB::FollowUp', + column_map => { id => 'note_id' }, + type => 'one to many', + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Order.pm b/SL/DB/MetaSetup/Order.pm index 063ca0b0f..397db119a 100644 --- a/SL/DB/MetaSetup/Order.pm +++ b/SL/DB/MetaSetup/Order.pm @@ -6,119 +6,109 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'oe', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - ordnumber => { type => 'text', not_null => 1 }, - transdate => { type => 'date', default => 'now' }, - vendor_id => { type => 'integer' }, - customer_id => { type => 'integer' }, - amount => { type => 'numeric', precision => 5, scale => 15 }, - netamount => { type => 'numeric', precision => 5, scale => 15 }, - reqdate => { type => 'date' }, - taxincluded => { type => 'boolean' }, - shippingpoint => { type => 'text' }, - notes => { type => 'text' }, - employee_id => { type => 'integer' }, - closed => { type => 'boolean', default => 'false' }, - quotation => { type => 'boolean', default => 'false' }, - quonumber => { type => 'text' }, - cusordnumber => { type => 'text' }, - intnotes => { type => 'text' }, - department_id => { type => 'integer' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - shipvia => { type => 'text' }, - cp_id => { type => 'integer' }, - language_id => { type => 'integer' }, - payment_id => { type => 'integer' }, - delivery_customer_id => { type => 'integer' }, - delivery_vendor_id => { type => 'integer' }, - taxzone_id => { type => 'integer' }, - proforma => { type => 'boolean', default => 'false' }, - shipto_id => { type => 'integer' }, - delivered => { type => 'boolean', default => 'false' }, - globalproject_id => { type => 'integer' }, - salesman_id => { type => 'integer' }, - marge_total => { type => 'numeric', precision => 5, scale => 15 }, - marge_percent => { type => 'numeric', precision => 5, scale => 15 }, - transaction_description => { type => 'text' }, - currency_id => { type => 'integer', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - contact => { - class => 'SL::DB::Contact', - key_columns => { cp_id => 'cp_id' }, - }, - - currency => { - class => 'SL::DB::Currency', - key_columns => { currency_id => 'id' }, - }, - - customer => { - class => 'SL::DB::Customer', - key_columns => { customer_id => 'id' }, - }, - - delivery_customer => { - class => 'SL::DB::Customer', - key_columns => { delivery_customer_id => 'id' }, - }, - - delivery_vendor => { - class => 'SL::DB::Vendor', - key_columns => { delivery_vendor_id => 'id' }, - }, - - department => { - class => 'SL::DB::Department', - key_columns => { department_id => 'id' }, - }, - - employee => { - class => 'SL::DB::Employee', - key_columns => { employee_id => 'id' }, - }, - - globalproject => { - class => 'SL::DB::Project', - key_columns => { globalproject_id => 'id' }, - }, - - language => { - class => 'SL::DB::Language', - key_columns => { language_id => 'id' }, - }, - - payment_terms => { - class => 'SL::DB::PaymentTerm', - key_columns => { payment_id => 'id' }, - }, - - salesman => { - class => 'SL::DB::Employee', - key_columns => { salesman_id => 'id' }, - }, - - shipto => { - class => 'SL::DB::Shipto', - key_columns => { shipto_id => 'shipto_id' }, - }, - - vendor => { - class => 'SL::DB::Vendor', - key_columns => { vendor_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('oe'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + ordnumber => { type => 'text', not_null => 1 }, + transdate => { type => 'date', default => 'now' }, + vendor_id => { type => 'integer' }, + customer_id => { type => 'integer' }, + amount => { type => 'numeric', precision => 5, scale => 15 }, + netamount => { type => 'numeric', precision => 5, scale => 15 }, + reqdate => { type => 'date' }, + taxincluded => { type => 'boolean' }, + shippingpoint => { type => 'text' }, + notes => { type => 'text' }, + employee_id => { type => 'integer' }, + closed => { type => 'boolean', default => 'false' }, + quotation => { type => 'boolean', default => 'false' }, + quonumber => { type => 'text' }, + cusordnumber => { type => 'text' }, + intnotes => { type => 'text' }, + department_id => { type => 'integer' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + shipvia => { type => 'text' }, + cp_id => { type => 'integer' }, + language_id => { type => 'integer' }, + payment_id => { type => 'integer' }, + delivery_customer_id => { type => 'integer' }, + delivery_vendor_id => { type => 'integer' }, + taxzone_id => { type => 'integer' }, + proforma => { type => 'boolean', default => 'false' }, + shipto_id => { type => 'integer' }, + delivered => { type => 'boolean', default => 'false' }, + globalproject_id => { type => 'integer' }, + salesman_id => { type => 'integer' }, + transaction_description => { type => 'text' }, + marge_total => { type => 'numeric', precision => 5, scale => 15 }, + marge_percent => { type => 'numeric', precision => 5, scale => 15 }, + currency_id => { type => 'integer', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + contact => { + class => 'SL::DB::Contact', + key_columns => { cp_id => 'cp_id' }, + }, + + currency => { + class => 'SL::DB::Currency', + key_columns => { currency_id => 'id' }, + }, + + customer => { + class => 'SL::DB::Customer', + key_columns => { customer_id => 'id' }, + }, + + delivery_customer => { + class => 'SL::DB::Customer', + key_columns => { delivery_customer_id => 'id' }, + }, + + delivery_vendor => { + class => 'SL::DB::Vendor', + key_columns => { delivery_vendor_id => 'id' }, + }, + + department => { + class => 'SL::DB::Department', + key_columns => { department_id => 'id' }, + }, + + employee => { + class => 'SL::DB::Employee', + key_columns => { employee_id => 'id' }, + }, + + globalproject => { + class => 'SL::DB::Project', + key_columns => { globalproject_id => 'id' }, + }, + + language => { + class => 'SL::DB::Language', + key_columns => { language_id => 'id' }, + }, + + salesman => { + class => 'SL::DB::Employee', + key_columns => { salesman_id => 'id' }, + }, + + vendor => { + class => 'SL::DB::Vendor', + key_columns => { vendor_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/OrderItem.pm b/SL/DB/MetaSetup/OrderItem.pm index 3d0c98e7e..dd2fde76e 100644 --- a/SL/DB/MetaSetup/OrderItem.pm +++ b/SL/DB/MetaSetup/OrderItem.pm @@ -6,70 +6,70 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'orderitems', +__PACKAGE__->meta->table('orderitems'); - columns => [ - trans_id => { type => 'integer' }, - parts_id => { type => 'integer' }, - description => { type => 'text' }, - qty => { type => 'float', precision => 4 }, - sellprice => { type => 'numeric', precision => 5, scale => 15 }, - discount => { type => 'float', precision => 4 }, - project_id => { type => 'integer' }, - reqdate => { type => 'date' }, - ship => { type => 'float', precision => 4 }, - serialnumber => { type => 'text' }, - id => { type => 'integer', not_null => 1, sequence => 'orderitemsid' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - pricegroup_id => { type => 'integer' }, - ordnumber => { type => 'text' }, - transdate => { type => 'text' }, - cusordnumber => { type => 'text' }, - unit => { type => 'varchar', length => 20 }, - base_qty => { type => 'float', precision => 4 }, - subtotal => { type => 'boolean', default => 'false' }, - longdescription => { type => 'text' }, - marge_total => { type => 'numeric', precision => 5, scale => 15 }, - marge_percent => { type => 'numeric', precision => 5, scale => 15 }, - lastcost => { type => 'numeric', precision => 5, scale => 15 }, - price_factor_id => { type => 'integer' }, - price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 }, - marge_price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 }, - ], +__PACKAGE__->meta->columns( + trans_id => { type => 'integer' }, + parts_id => { type => 'integer' }, + description => { type => 'text' }, + qty => { type => 'float', precision => 4 }, + sellprice => { type => 'numeric', precision => 5, scale => 15 }, + discount => { type => 'float', precision => 4 }, + project_id => { type => 'integer' }, + reqdate => { type => 'date' }, + ship => { type => 'float', precision => 4 }, + serialnumber => { type => 'text' }, + id => { type => 'integer', not_null => 1, sequence => 'orderitemsid' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + pricegroup_id => { type => 'integer' }, + ordnumber => { type => 'text' }, + transdate => { type => 'text' }, + cusordnumber => { type => 'text' }, + unit => { type => 'varchar', length => 20 }, + base_qty => { type => 'float', precision => 4 }, + subtotal => { type => 'boolean', default => 'false' }, + longdescription => { type => 'text' }, + marge_total => { type => 'numeric', precision => 5, scale => 15 }, + marge_percent => { type => 'numeric', precision => 5, scale => 15 }, + lastcost => { type => 'numeric', precision => 5, scale => 15 }, + price_factor_id => { type => 'integer' }, + price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 }, + marge_price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 }, +); - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - allow_inline_column_values => 1, +__PACKAGE__->meta->allow_inline_column_values(1); - foreign_keys => [ - part => { - class => 'SL::DB::Part', - key_columns => { parts_id => 'id' }, - }, +__PACKAGE__->meta->foreign_keys( + part => { + class => 'SL::DB::Part', + key_columns => { parts_id => 'id' }, + }, - price_factor_obj => { - class => 'SL::DB::PriceFactor', - key_columns => { price_factor_id => 'id' }, - }, + price_factor_obj => { + class => 'SL::DB::PriceFactor', + key_columns => { price_factor_id => 'id' }, + }, - pricegroup => { - class => 'SL::DB::Pricegroup', - key_columns => { pricegroup_id => 'id' }, - }, + pricegroup => { + class => 'SL::DB::Pricegroup', + key_columns => { pricegroup_id => 'id' }, + }, - project => { - class => 'SL::DB::Project', - key_columns => { project_id => 'id' }, - }, + project => { + class => 'SL::DB::Project', + key_columns => { project_id => 'id' }, + }, - order => { - class => 'SL::DB::Order', - key_columns => { trans_id => 'id' }, - }, - ], + order => { + class => 'SL::DB::Order', + key_columns => { trans_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Part.pm b/SL/DB/MetaSetup/Part.pm index bdc726ef1..d56c03764 100644 --- a/SL/DB/MetaSetup/Part.pm +++ b/SL/DB/MetaSetup/Part.pm @@ -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; ; diff --git a/SL/DB/MetaSetup/PartsGroup.pm b/SL/DB/MetaSetup/PartsGroup.pm index 166f2b8db..292489e19 100644 --- a/SL/DB/MetaSetup/PartsGroup.pm +++ b/SL/DB/MetaSetup/PartsGroup.pm @@ -6,20 +6,28 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'partsgroup', +__PACKAGE__->meta->table('partsgroup'); - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - partsgroup => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - ], +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + partsgroup => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->allow_inline_column_values(1); - allow_inline_column_values => 1, +__PACKAGE__->meta->relationships( + parts => { + class => 'SL::DB::Part', + column_map => { id => 'partsgroup_id' }, + type => 'one to many', + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/PaymentTerm.pm b/SL/DB/MetaSetup/PaymentTerm.pm index 4e18f5df0..3eda536ac 100644 --- a/SL/DB/MetaSetup/PaymentTerm.pm +++ b/SL/DB/MetaSetup/PaymentTerm.pm @@ -6,26 +6,58 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'payment_terms', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - description => { type => 'text' }, - description_long => { type => 'text' }, - terms_netto => { type => 'integer' }, - terms_skonto => { type => 'integer' }, - percent_skonto => { type => 'float', precision => 4 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - ranking => { type => 'integer' }, - sortkey => { type => 'integer', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->table('payment_terms'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + description => { type => 'text' }, + description_long => { type => 'text' }, + terms_netto => { type => 'integer' }, + terms_skonto => { type => 'integer' }, + percent_skonto => { type => 'float', precision => 4 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + ranking => { type => 'integer' }, + sortkey => { type => 'integer', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->relationships( + ap => { + class => 'SL::DB::PurchaseInvoice', + column_map => { id => 'payment_id' }, + type => 'one to many', + }, + + ar => { + class => 'SL::DB::Invoice', + column_map => { id => 'payment_id' }, + type => 'one to many', + }, + + customer => { + class => 'SL::DB::Customer', + column_map => { id => 'payment_id' }, + type => 'one to many', + }, + + oe => { + class => 'SL::DB::Order', + column_map => { id => 'payment_id' }, + type => 'one to many', + }, + + parts => { + class => 'SL::DB::Part', + column_map => { id => 'payment_id' }, + type => 'one to many', + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/PeriodicInvoice.pm b/SL/DB/MetaSetup/PeriodicInvoice.pm index 2a7abc992..11822c1c7 100644 --- a/SL/DB/MetaSetup/PeriodicInvoice.pm +++ b/SL/DB/MetaSetup/PeriodicInvoice.pm @@ -6,33 +6,28 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'periodic_invoices', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - config_id => { type => 'integer', not_null => 1 }, - ar_id => { type => 'integer', not_null => 1 }, - period_start_date => { type => 'date', not_null => 1 }, - itime => { type => 'timestamp', default => 'now()' }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - ar => { - class => 'SL::DB::Invoice', - key_columns => { ar_id => 'id' }, - }, - - config => { - class => 'SL::DB::PeriodicInvoicesConfig', - key_columns => { config_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('periodic_invoices'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + config_id => { type => 'integer', not_null => 1 }, + ar_id => { type => 'integer', not_null => 1 }, + period_start_date => { type => 'date', not_null => 1 }, + itime => { type => 'timestamp', default => 'now()' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + ar => { + class => 'SL::DB::Invoice', + key_columns => { ar_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/PeriodicInvoicesConfig.pm b/SL/DB/MetaSetup/PeriodicInvoicesConfig.pm index 8860e8c80..414918a64 100644 --- a/SL/DB/MetaSetup/PeriodicInvoicesConfig.pm +++ b/SL/DB/MetaSetup/PeriodicInvoicesConfig.pm @@ -6,43 +6,47 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'periodic_invoices_configs', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - oe_id => { type => 'integer', not_null => 1 }, - periodicity => { type => 'varchar', length => 10, not_null => 1 }, - print => { type => 'boolean', default => 'false' }, - printer_id => { type => 'integer' }, - copies => { type => 'integer' }, - active => { type => 'boolean', default => 'true' }, - start_date => { type => 'date' }, - ar_chart_id => { type => 'integer', not_null => 1 }, - terminated => { type => 'boolean', default => 'false' }, - end_date => { type => 'date' }, - extend_automatically_by => { type => 'integer' }, - ], - - primary_key_columns => [ 'id' ], - - foreign_keys => [ - ar_chart => { - class => 'SL::DB::Chart', - key_columns => { ar_chart_id => 'id' }, - }, - - order => { - class => 'SL::DB::Order', - key_columns => { oe_id => 'id' }, - }, - - printer => { - class => 'SL::DB::Printer', - key_columns => { printer_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('periodic_invoices_configs'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + oe_id => { type => 'integer', not_null => 1 }, + periodicity => { type => 'varchar', length => 10, not_null => 1 }, + print => { type => 'boolean', default => 'false' }, + printer_id => { type => 'integer' }, + copies => { type => 'integer' }, + active => { type => 'boolean', default => 'true' }, + terminated => { type => 'boolean', default => 'false' }, + start_date => { type => 'date' }, + end_date => { type => 'date' }, + ar_chart_id => { type => 'integer', not_null => 1 }, + extend_automatically_by => { type => 'integer' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->foreign_keys( + ar_chart => { + class => 'SL::DB::Chart', + key_columns => { ar_chart_id => 'id' }, + }, + + oe => { + class => 'SL::DB::Order', + key_columns => { oe_id => 'id' }, + }, +); + +__PACKAGE__->meta->relationships( + ars => { + map_class => 'SL::DB::PeriodicInvoice', + map_from => 'config', + map_to => 'ar', + type => 'many to many', + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Price.pm b/SL/DB/MetaSetup/Price.pm index bb6f0fd38..2fec15f4e 100644 --- a/SL/DB/MetaSetup/Price.pm +++ b/SL/DB/MetaSetup/Price.pm @@ -6,30 +6,30 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'prices', - - columns => [ - parts_id => { type => 'integer' }, - pricegroup_id => { type => 'integer' }, - price => { type => 'numeric', precision => 5, scale => 15 }, - id => { type => 'serial', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - foreign_keys => [ - parts => { - class => 'SL::DB::Part', - key_columns => { parts_id => 'id' }, - }, - - pricegroup => { - class => 'SL::DB::Pricegroup', - key_columns => { pricegroup_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('prices'); + +__PACKAGE__->meta->columns( + parts_id => { type => 'integer' }, + pricegroup_id => { type => 'integer' }, + price => { type => 'numeric', precision => 5, scale => 15 }, + id => { type => 'serial', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->foreign_keys( + parts => { + class => 'SL::DB::Part', + key_columns => { parts_id => 'id' }, + }, + + pricegroup => { + class => 'SL::DB::Pricegroup', + key_columns => { pricegroup_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/PriceFactor.pm b/SL/DB/MetaSetup/PriceFactor.pm index 2eeb5967a..3d0aa778c 100644 --- a/SL/DB/MetaSetup/PriceFactor.pm +++ b/SL/DB/MetaSetup/PriceFactor.pm @@ -6,18 +6,38 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'price_factors', +__PACKAGE__->meta->table('price_factors'); - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - description => { type => 'text' }, - factor => { type => 'numeric', precision => 5, scale => 15 }, - sortkey => { type => 'integer' }, - ], +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + description => { type => 'text' }, + factor => { type => 'numeric', precision => 5, scale => 15 }, + sortkey => { type => 'integer' }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->relationships( + invoice => { + class => 'SL::DB::InvoiceItem', + column_map => { id => 'price_factor_id' }, + type => 'one to many', + }, - primary_key_columns => [ 'id' ], + orderitems => { + class => 'SL::DB::OrderItem', + column_map => { id => 'price_factor_id' }, + type => 'one to many', + }, + + parts => { + class => 'SL::DB::Part', + column_map => { id => 'price_factor_id' }, + type => 'one to many', + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Pricegroup.pm b/SL/DB/MetaSetup/Pricegroup.pm index 09ce0938e..c4491c1a4 100644 --- a/SL/DB/MetaSetup/Pricegroup.pm +++ b/SL/DB/MetaSetup/Pricegroup.pm @@ -6,16 +6,36 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'pricegroup', +__PACKAGE__->meta->table('pricegroup'); - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - pricegroup => { type => 'text', not_null => 1 }, - ], +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + pricegroup => { type => 'text', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->relationships( + delivery_order_items => { + class => 'SL::DB::DeliveryOrderItem', + column_map => { id => 'pricegroup_id' }, + type => 'one to many', + }, - primary_key_columns => [ 'id' ], + invoice => { + class => 'SL::DB::InvoiceItem', + column_map => { id => 'pricegroup_id' }, + type => 'one to many', + }, + + orderitems => { + class => 'SL::DB::OrderItem', + column_map => { id => 'pricegroup_id' }, + type => 'one to many', + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Printer.pm b/SL/DB/MetaSetup/Printer.pm index fc2446a1b..739be1dde 100644 --- a/SL/DB/MetaSetup/Printer.pm +++ b/SL/DB/MetaSetup/Printer.pm @@ -6,18 +6,26 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'printers', +__PACKAGE__->meta->table('printers'); - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - printer_description => { type => 'text', not_null => 1 }, - printer_command => { type => 'text' }, - template_code => { type => 'text' }, - ], +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + printer_description => { type => 'text', not_null => 1 }, + printer_command => { type => 'text' }, + template_code => { type => 'text' }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->relationships( + periodic_invoices_configs => { + class => 'SL::DB::PeriodicInvoicesConfig', + column_map => { id => 'printer_id' }, + type => 'one to many', + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Project.pm b/SL/DB/MetaSetup/Project.pm index a492b46ca..c6b2c42c4 100644 --- a/SL/DB/MetaSetup/Project.pm +++ b/SL/DB/MetaSetup/Project.pm @@ -6,34 +6,34 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'project', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - projectnumber => { type => 'text' }, - description => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - active => { type => 'boolean', default => 'true' }, - customer_id => { type => 'integer' }, - type => { type => 'text' }, - valid => { type => 'boolean', default => 'true' }, - ], - - primary_key_columns => [ 'id' ], - - unique_key => [ 'projectnumber' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - customer => { - class => 'SL::DB::Customer', - key_columns => { customer_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('project'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + projectnumber => { type => 'text' }, + description => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + active => { type => 'boolean', default => 'true' }, + customer_id => { type => 'integer' }, + type => { type => 'text' }, + valid => { type => 'boolean', default => 'true' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->unique_keys([ 'projectnumber' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + customer => { + class => 'SL::DB::Customer', + key_columns => { customer_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/PurchaseInvoice.pm b/SL/DB/MetaSetup/PurchaseInvoice.pm index e484fb933..25727dc92 100644 --- a/SL/DB/MetaSetup/PurchaseInvoice.pm +++ b/SL/DB/MetaSetup/PurchaseInvoice.pm @@ -6,98 +6,73 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'ap', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'glid' }, - invnumber => { type => 'text', not_null => 1 }, - transdate => { type => 'date', default => 'now' }, - gldate => { type => 'date', default => 'now' }, - vendor_id => { type => 'integer' }, - taxincluded => { type => 'boolean', default => 'false' }, - amount => { type => 'numeric', precision => 5, scale => 15 }, - netamount => { type => 'numeric', precision => 5, scale => 15 }, - paid => { type => 'numeric', precision => 5, scale => 15 }, - datepaid => { type => 'date' }, - duedate => { type => 'date' }, - invoice => { type => 'boolean', default => 'false' }, - ordnumber => { type => 'text' }, - notes => { type => 'text' }, - employee_id => { type => 'integer' }, - quonumber => { type => 'text' }, - intnotes => { type => 'text' }, - department_id => { type => 'integer' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - shipvia => { type => 'text' }, - cp_id => { type => 'integer' }, - language_id => { type => 'integer' }, - payment_id => { type => 'integer' }, - storno => { type => 'boolean', default => 'false' }, - taxzone_id => { type => 'integer' }, - type => { type => 'text' }, - orddate => { type => 'date' }, - quodate => { type => 'date' }, - globalproject_id => { type => 'integer' }, - transaction_description => { type => 'text' }, - storno_id => { type => 'integer' }, - direct_debit => { type => 'boolean', default => 'false' }, - deliverydate => { type => 'date' }, - currency_id => { type => 'integer', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - contact => { - class => 'SL::DB::Contact', - key_columns => { cp_id => 'cp_id' }, - }, - - currency => { - class => 'SL::DB::Currency', - key_columns => { currency_id => 'id' }, - }, - - department => { - class => 'SL::DB::Department', - key_columns => { department_id => 'id' }, - }, +__PACKAGE__->meta->table('ap'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'glid' }, + invnumber => { type => 'text', not_null => 1 }, + transdate => { type => 'date', default => 'now' }, + gldate => { type => 'date', default => 'now' }, + vendor_id => { type => 'integer' }, + taxincluded => { type => 'boolean', default => 'false' }, + amount => { type => 'numeric', precision => 5, scale => 15 }, + netamount => { type => 'numeric', precision => 5, scale => 15 }, + paid => { type => 'numeric', precision => 5, scale => 15 }, + datepaid => { type => 'date' }, + duedate => { type => 'date' }, + invoice => { type => 'boolean', default => 'false' }, + ordnumber => { type => 'text' }, + notes => { type => 'text' }, + employee_id => { type => 'integer' }, + quonumber => { type => 'text' }, + intnotes => { type => 'text' }, + department_id => { type => 'integer' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + shipvia => { type => 'text' }, + cp_id => { type => 'integer' }, + language_id => { type => 'integer' }, + payment_id => { type => 'integer' }, + storno => { type => 'boolean', default => 'false' }, + taxzone_id => { type => 'integer' }, + type => { type => 'text' }, + orddate => { type => 'date' }, + quodate => { type => 'date' }, + globalproject_id => { type => 'integer' }, + transaction_description => { type => 'text' }, + storno_id => { type => 'integer' }, + direct_debit => { type => 'boolean', default => 'false' }, + deliverydate => { type => 'date' }, + currency_id => { type => 'integer', not_null => 1 }, +); - employee => { - class => 'SL::DB::Employee', - key_columns => { employee_id => 'id' }, - }, +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - globalproject => { - class => 'SL::DB::Project', - key_columns => { globalproject_id => 'id' }, - }, +__PACKAGE__->meta->allow_inline_column_values(1); - language => { - class => 'SL::DB::Language', - key_columns => { language_id => 'id' }, - }, +__PACKAGE__->meta->foreign_keys( + contact => { + class => 'SL::DB::Contact', + key_columns => { cp_id => 'cp_id' }, + }, - payment_terms => { - class => 'SL::DB::PaymentTerm', - key_columns => { payment_id => 'id' }, - }, + globalproject => { + class => 'SL::DB::Project', + key_columns => { globalproject_id => 'id' }, + }, - storno_obj => { - class => 'SL::DB::PurchaseInvoice', - key_columns => { storno_id => 'id' }, - }, + storno_obj => { + class => 'SL::DB::PurchaseInvoice', + key_columns => { storno_id => 'id' }, + }, - vendor => { - class => 'SL::DB::Vendor', - key_columns => { vendor_id => 'id' }, - }, - ], + vendor => { + class => 'SL::DB::Vendor', + key_columns => { vendor_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/RecordLink.pm b/SL/DB/MetaSetup/RecordLink.pm index 4059be814..7bbd67a27 100644 --- a/SL/DB/MetaSetup/RecordLink.pm +++ b/SL/DB/MetaSetup/RecordLink.pm @@ -6,22 +6,22 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'record_links', +__PACKAGE__->meta->table('record_links'); - columns => [ - from_table => { type => 'varchar', length => 50, not_null => 1 }, - from_id => { type => 'integer', not_null => 1 }, - to_table => { type => 'varchar', length => 50, not_null => 1 }, - to_id => { type => 'integer', not_null => 1 }, - itime => { type => 'timestamp', default => 'now()' }, - id => { type => 'serial', not_null => 1 }, - ], +__PACKAGE__->meta->columns( + from_table => { type => 'varchar', length => 50, not_null => 1 }, + from_id => { type => 'integer', not_null => 1 }, + to_table => { type => 'varchar', length => 50, not_null => 1 }, + to_id => { type => 'integer', not_null => 1 }, + itime => { type => 'timestamp', default => 'now()' }, + id => { type => 'serial', not_null => 1 }, +); - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - allow_inline_column_values => 1, -); +__PACKAGE__->meta->allow_inline_column_values(1); + +# __PACKAGE__->meta->initialize; 1; ; diff --git a/SL/DB/MetaSetup/SchemaInfo.pm b/SL/DB/MetaSetup/SchemaInfo.pm index 0a1e70ef3..9eddb4bf7 100644 --- a/SL/DB/MetaSetup/SchemaInfo.pm +++ b/SL/DB/MetaSetup/SchemaInfo.pm @@ -6,19 +6,19 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'schema_info', +__PACKAGE__->meta->table('schema_info'); - columns => [ - tag => { type => 'text', not_null => 1 }, - login => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - ], +__PACKAGE__->meta->columns( + tag => { type => 'text', not_null => 1 }, + login => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, +); - primary_key_columns => [ 'tag' ], +__PACKAGE__->meta->primary_key_columns([ 'tag' ]); - allow_inline_column_values => 1, -); +__PACKAGE__->meta->allow_inline_column_values(1); + +# __PACKAGE__->meta->initialize; 1; ; diff --git a/SL/DB/MetaSetup/SepaExport.pm b/SL/DB/MetaSetup/SepaExport.pm index da0981799..768597a8c 100644 --- a/SL/DB/MetaSetup/SepaExport.pm +++ b/SL/DB/MetaSetup/SepaExport.pm @@ -6,29 +6,29 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'sepa_export', - - columns => [ - id => { type => 'serial', not_null => 1 }, - employee_id => { type => 'integer', not_null => 1 }, - executed => { type => 'boolean', default => 'false' }, - closed => { type => 'boolean', default => 'false' }, - itime => { type => 'timestamp', default => 'now()' }, - vc => { type => 'varchar', length => 10 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - employee => { - class => 'SL::DB::Employee', - key_columns => { employee_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('sepa_export'); + +__PACKAGE__->meta->columns( + id => { type => 'serial', not_null => 1 }, + employee_id => { type => 'integer', not_null => 1 }, + executed => { type => 'boolean', default => 'false' }, + closed => { type => 'boolean', default => 'false' }, + itime => { type => 'timestamp', default => 'now()' }, + vc => { type => 'varchar', length => 10 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + employee => { + class => 'SL::DB::Employee', + key_columns => { employee_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/SepaExportItem.pm b/SL/DB/MetaSetup/SepaExportItem.pm index cd2152bed..40a3fc012 100644 --- a/SL/DB/MetaSetup/SepaExportItem.pm +++ b/SL/DB/MetaSetup/SepaExportItem.pm @@ -6,51 +6,51 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'sepa_export_items', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - sepa_export_id => { type => 'integer', not_null => 1 }, - ap_id => { type => 'integer' }, - chart_id => { type => 'integer', not_null => 1 }, - amount => { type => 'numeric', precision => 5, scale => 25 }, - reference => { type => 'varchar', length => 35 }, - requested_execution_date => { type => 'date' }, - executed => { type => 'boolean', default => 'false' }, - execution_date => { type => 'date' }, - our_iban => { type => 'varchar', length => 100 }, - our_bic => { type => 'varchar', length => 100 }, - vc_iban => { type => 'varchar', length => 100 }, - vc_bic => { type => 'varchar', length => 100 }, - end_to_end_id => { type => 'varchar', length => 35 }, - ar_id => { type => 'integer' }, - ], - - primary_key_columns => [ 'id' ], - - foreign_keys => [ - ap => { - class => 'SL::DB::PurchaseInvoice', - key_columns => { ap_id => 'id' }, - }, - - ar => { - class => 'SL::DB::Invoice', - key_columns => { ar_id => 'id' }, - }, - - chart => { - class => 'SL::DB::Chart', - key_columns => { chart_id => 'id' }, - }, - - sepa_export => { - class => 'SL::DB::SepaExport', - key_columns => { sepa_export_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('sepa_export_items'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + sepa_export_id => { type => 'integer', not_null => 1 }, + ap_id => { type => 'integer' }, + chart_id => { type => 'integer', not_null => 1 }, + amount => { type => 'numeric', precision => 5, scale => 25 }, + reference => { type => 'varchar', length => 35 }, + requested_execution_date => { type => 'date' }, + executed => { type => 'boolean', default => 'false' }, + execution_date => { type => 'date' }, + our_iban => { type => 'varchar', length => 100 }, + our_bic => { type => 'varchar', length => 100 }, + vc_iban => { type => 'varchar', length => 100 }, + vc_bic => { type => 'varchar', length => 100 }, + end_to_end_id => { type => 'varchar', length => 35 }, + ar_id => { type => 'integer' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->foreign_keys( + ap => { + class => 'SL::DB::PurchaseInvoice', + key_columns => { ap_id => 'id' }, + }, + + ar => { + class => 'SL::DB::Invoice', + key_columns => { ar_id => 'id' }, + }, + + chart => { + class => 'SL::DB::Chart', + key_columns => { chart_id => 'id' }, + }, + + sepa_export => { + class => 'SL::DB::SepaExport', + key_columns => { sepa_export_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Shipto.pm b/SL/DB/MetaSetup/Shipto.pm index cde5a320d..0d619eabe 100644 --- a/SL/DB/MetaSetup/Shipto.pm +++ b/SL/DB/MetaSetup/Shipto.pm @@ -6,33 +6,53 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'shipto', - - columns => [ - trans_id => { type => 'integer' }, - shiptoname => { type => 'varchar', length => 75 }, - shiptodepartment_1 => { type => 'varchar', length => 75 }, - shiptodepartment_2 => { type => 'varchar', length => 75 }, - shiptostreet => { type => 'varchar', length => 75 }, - shiptozipcode => { type => 'varchar', length => 75 }, - shiptocity => { type => 'varchar', length => 75 }, - shiptocountry => { type => 'varchar', length => 75 }, - shiptocontact => { type => 'varchar', length => 75 }, - shiptophone => { type => 'varchar', length => 30 }, - shiptofax => { type => 'varchar', length => 30 }, - shiptoemail => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - module => { type => 'text' }, - shipto_id => { type => 'integer', not_null => 1, sequence => 'id' }, - shiptocp_gender => { type => 'text' }, - ], - - primary_key_columns => [ 'shipto_id' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->table('shipto'); + +__PACKAGE__->meta->columns( + trans_id => { type => 'integer' }, + shiptoname => { type => 'varchar', length => 75 }, + shiptodepartment_1 => { type => 'varchar', length => 75 }, + shiptodepartment_2 => { type => 'varchar', length => 75 }, + shiptostreet => { type => 'varchar', length => 75 }, + shiptozipcode => { type => 'varchar', length => 75 }, + shiptocity => { type => 'varchar', length => 75 }, + shiptocountry => { type => 'varchar', length => 75 }, + shiptocontact => { type => 'varchar', length => 75 }, + shiptophone => { type => 'varchar', length => 30 }, + shiptofax => { type => 'varchar', length => 30 }, + shiptoemail => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + module => { type => 'text' }, + shipto_id => { type => 'integer', not_null => 1, sequence => 'id' }, + shiptocp_gender => { type => 'text' }, +); + +__PACKAGE__->meta->primary_key_columns([ 'shipto_id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->relationships( + ar => { + class => 'SL::DB::Invoice', + column_map => { shipto_id => 'shipto_id' }, + type => 'one to many', + }, + + delivery_orders => { + class => 'SL::DB::DeliveryOrder', + column_map => { shipto_id => 'shipto_id' }, + type => 'one to many', + }, + + oe => { + class => 'SL::DB::Order', + column_map => { shipto_id => 'shipto_id' }, + type => 'one to many', + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Status.pm b/SL/DB/MetaSetup/Status.pm index c916a7842..ccc826708 100644 --- a/SL/DB/MetaSetup/Status.pm +++ b/SL/DB/MetaSetup/Status.pm @@ -6,25 +6,25 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'status', - - columns => [ - trans_id => { type => 'integer' }, - formname => { type => 'text' }, - printed => { type => 'boolean', default => 'false' }, - emailed => { type => 'boolean', default => 'false' }, - spoolfile => { type => 'text' }, - chart_id => { type => 'integer' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - id => { type => 'serial', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, +__PACKAGE__->meta->table('status'); + +__PACKAGE__->meta->columns( + trans_id => { type => 'integer' }, + formname => { type => 'text' }, + printed => { type => 'boolean', default => 'false' }, + emailed => { type => 'boolean', default => 'false' }, + spoolfile => { type => 'text' }, + chart_id => { type => 'integer' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + id => { type => 'serial', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Tax.pm b/SL/DB/MetaSetup/Tax.pm index de8538e71..9903067e3 100644 --- a/SL/DB/MetaSetup/Tax.pm +++ b/SL/DB/MetaSetup/Tax.pm @@ -6,32 +6,32 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'tax', - - columns => [ - chart_id => { type => 'integer' }, - rate => { type => 'numeric', default => '0', not_null => 1, precision => 5, scale => 15 }, - taxnumber => { type => 'text' }, - taxkey => { type => 'integer', not_null => 1 }, - taxdescription => { type => 'text', not_null => 1 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - id => { type => 'integer', not_null => 1, sequence => 'id' }, - chart_categories => { type => 'text', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - chart => { - class => 'SL::DB::Chart', - key_columns => { chart_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('tax'); + +__PACKAGE__->meta->columns( + chart_id => { type => 'integer' }, + rate => { type => 'numeric', default => '0', not_null => 1, precision => 5, scale => 15 }, + taxnumber => { type => 'text' }, + taxkey => { type => 'integer', not_null => 1 }, + taxdescription => { type => 'text', not_null => 1 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + id => { type => 'integer', not_null => 1, sequence => 'id' }, + chart_categories => { type => 'text', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + chart => { + class => 'SL::DB::Chart', + key_columns => { chart_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/TaxKey.pm b/SL/DB/MetaSetup/TaxKey.pm index 3dc0895cb..4265037b5 100644 --- a/SL/DB/MetaSetup/TaxKey.pm +++ b/SL/DB/MetaSetup/TaxKey.pm @@ -6,34 +6,34 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'taxkeys', - - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - chart_id => { type => 'integer', not_null => 1 }, - tax_id => { type => 'integer', not_null => 1 }, - taxkey_id => { type => 'integer', not_null => 1 }, - pos_ustva => { type => 'integer' }, - startdate => { type => 'date', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - unique_key => [ 'chart_id', 'startdate' ], - - foreign_keys => [ - chart => { - class => 'SL::DB::Chart', - key_columns => { chart_id => 'id' }, - }, - - tax => { - class => 'SL::DB::Tax', - key_columns => { tax_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('taxkeys'); + +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + chart_id => { type => 'integer', not_null => 1 }, + tax_id => { type => 'integer', not_null => 1 }, + taxkey_id => { type => 'integer', not_null => 1 }, + pos_ustva => { type => 'integer' }, + startdate => { type => 'date', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->unique_keys([ 'chart_id', 'startdate' ]); + +__PACKAGE__->meta->foreign_keys( + chart => { + class => 'SL::DB::Chart', + key_columns => { chart_id => 'id' }, + }, + + tax => { + class => 'SL::DB::Tax', + key_columns => { tax_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/TaxZone.pm b/SL/DB/MetaSetup/TaxZone.pm index 5823d6833..0190c6367 100644 --- a/SL/DB/MetaSetup/TaxZone.pm +++ b/SL/DB/MetaSetup/TaxZone.pm @@ -6,16 +6,16 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'tax_zones', +__PACKAGE__->meta->table('tax_zones'); - columns => [ - id => { type => 'integer', not_null => 1 }, - description => { type => 'text' }, - ], - - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1 }, + description => { type => 'text' }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/TodoUserConfig.pm b/SL/DB/MetaSetup/TodoUserConfig.pm index 2be46cd10..3721e0ffe 100644 --- a/SL/DB/MetaSetup/TodoUserConfig.pm +++ b/SL/DB/MetaSetup/TodoUserConfig.pm @@ -6,28 +6,28 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'todo_user_config', - - columns => [ - employee_id => { type => 'integer', not_null => 1 }, - show_after_login => { type => 'boolean', default => 'true' }, - show_follow_ups => { type => 'boolean', default => 'true' }, - show_follow_ups_login => { type => 'boolean', default => 'true' }, - show_overdue_sales_quotations => { type => 'boolean', default => 'true' }, - show_overdue_sales_quotations_login => { type => 'boolean', default => 'true' }, - id => { type => 'serial', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - foreign_keys => [ - employee => { - class => 'SL::DB::Employee', - key_columns => { employee_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('todo_user_config'); + +__PACKAGE__->meta->columns( + employee_id => { type => 'integer', not_null => 1 }, + show_after_login => { type => 'boolean', default => 'true' }, + show_follow_ups => { type => 'boolean', default => 'true' }, + show_follow_ups_login => { type => 'boolean', default => 'true' }, + show_overdue_sales_quotations => { type => 'boolean', default => 'true' }, + show_overdue_sales_quotations_login => { type => 'boolean', default => 'true' }, + id => { type => 'serial', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->foreign_keys( + employee => { + class => 'SL::DB::Employee', + key_columns => { employee_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/TransferType.pm b/SL/DB/MetaSetup/TransferType.pm index 1f018bfd4..74a384070 100644 --- a/SL/DB/MetaSetup/TransferType.pm +++ b/SL/DB/MetaSetup/TransferType.pm @@ -6,22 +6,30 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'transfer_type', +__PACKAGE__->meta->table('transfer_type'); - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - direction => { type => 'varchar', length => 10, not_null => 1 }, - description => { type => 'text' }, - sortkey => { type => 'integer' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - ], +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + direction => { type => 'varchar', length => 10, not_null => 1 }, + description => { type => 'text' }, + sortkey => { type => 'integer' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->allow_inline_column_values(1); - allow_inline_column_values => 1, +__PACKAGE__->meta->relationships( + inventory => { + class => 'SL::DB::Inventory', + column_map => { id => 'trans_type_id' }, + type => 'one to many', + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Translation.pm b/SL/DB/MetaSetup/Translation.pm index 54165bb77..39075c894 100644 --- a/SL/DB/MetaSetup/Translation.pm +++ b/SL/DB/MetaSetup/Translation.pm @@ -6,30 +6,30 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'translation', - - columns => [ - parts_id => { type => 'integer' }, - language_id => { type => 'integer' }, - translation => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - longdescription => { type => 'text' }, - id => { type => 'serial', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - allow_inline_column_values => 1, - - foreign_keys => [ - language => { - class => 'SL::DB::Language', - key_columns => { language_id => 'id' }, - }, - ], +__PACKAGE__->meta->table('translation'); + +__PACKAGE__->meta->columns( + parts_id => { type => 'integer' }, + language_id => { type => 'integer' }, + translation => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + longdescription => { type => 'text' }, + id => { type => 'serial', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->allow_inline_column_values(1); + +__PACKAGE__->meta->foreign_keys( + language => { + class => 'SL::DB::Language', + key_columns => { language_id => 'id' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Unit.pm b/SL/DB/MetaSetup/Unit.pm index 6e05737df..0849b4eb3 100644 --- a/SL/DB/MetaSetup/Unit.pm +++ b/SL/DB/MetaSetup/Unit.pm @@ -6,29 +6,29 @@ 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' }, - }, - ], +__PACKAGE__->meta->table('units'); + +__PACKAGE__->meta->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 }, ); +__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' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/UnitsLanguage.pm b/SL/DB/MetaSetup/UnitsLanguage.pm index cd00dc869..f3c20f52c 100644 --- a/SL/DB/MetaSetup/UnitsLanguage.pm +++ b/SL/DB/MetaSetup/UnitsLanguage.pm @@ -6,31 +6,31 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'units_language', - - columns => [ - unit => { type => 'varchar', length => 20, not_null => 1 }, - language_id => { type => 'integer', not_null => 1 }, - localized => { type => 'varchar', length => 20 }, - localized_plural => { type => 'varchar', length => 20 }, - id => { type => 'serial', not_null => 1 }, - ], - - primary_key_columns => [ 'id' ], - - foreign_keys => [ - language => { - class => 'SL::DB::Language', - key_columns => { language_id => 'id' }, - }, - - unit_obj => { - class => 'SL::DB::Unit', - key_columns => { unit => 'name' }, - }, - ], +__PACKAGE__->meta->table('units_language'); + +__PACKAGE__->meta->columns( + unit => { type => 'varchar', length => 20, not_null => 1 }, + language_id => { type => 'integer', not_null => 1 }, + localized => { type => 'varchar', length => 20 }, + localized_plural => { type => 'varchar', length => 20 }, + id => { type => 'serial', not_null => 1 }, ); +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->foreign_keys( + language => { + class => 'SL::DB::Language', + key_columns => { language_id => 'id' }, + }, + + unit_obj => { + class => 'SL::DB::Unit', + key_columns => { unit => 'name' }, + }, +); + +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Vendor.pm b/SL/DB/MetaSetup/Vendor.pm index 14fb4a929..6ba58b5b3 100644 --- a/SL/DB/MetaSetup/Vendor.pm +++ b/SL/DB/MetaSetup/Vendor.pm @@ -6,81 +6,81 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'vendor', +__PACKAGE__->meta->table('vendor'); - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - name => { type => 'varchar', length => 75, not_null => 1 }, - department_1 => { type => 'varchar', length => 75 }, - department_2 => { type => 'varchar', length => 75 }, - street => { type => 'varchar', length => 75 }, - zipcode => { type => 'varchar', length => 10 }, - city => { type => 'varchar', length => 75 }, - country => { type => 'varchar', length => 75 }, - contact => { type => 'varchar', length => 75 }, - phone => { type => 'text' }, - fax => { type => 'varchar', length => 30 }, - homepage => { type => 'text' }, - email => { type => 'text' }, - notes => { type => 'text' }, - terms => { type => 'integer', default => '0' }, - taxincluded => { type => 'boolean' }, - vendornumber => { type => 'text' }, - cc => { type => 'text' }, - bcc => { type => 'text' }, - business_id => { type => 'integer' }, - taxnumber => { type => 'text' }, - discount => { type => 'float', precision => 4 }, - creditlimit => { type => 'numeric', precision => 5, scale => 15 }, - account_number => { type => 'varchar', length => 15 }, - bank_code => { type => 'varchar', length => 10 }, - bank => { type => 'text' }, - language => { type => 'varchar', length => 5 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - obsolete => { type => 'boolean', default => 'false' }, - username => { type => 'varchar', length => 50 }, - user_password => { type => 'varchar', length => 12 }, - salesman_id => { type => 'integer' }, - v_customer_id => { type => 'text' }, - language_id => { type => 'integer' }, - payment_id => { type => 'integer' }, - taxzone_id => { type => 'integer', default => '0', not_null => 1 }, - greeting => { type => 'text' }, - ustid => { type => 'varchar', length => 14 }, - iban => { type => 'varchar', length => 100 }, - bic => { type => 'varchar', length => 100 }, - direct_debit => { type => 'boolean', default => 'false' }, - currency_id => { type => 'integer', not_null => 1 }, - ], +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + name => { type => 'varchar', length => 75, not_null => 1 }, + department_1 => { type => 'varchar', length => 75 }, + department_2 => { type => 'varchar', length => 75 }, + street => { type => 'varchar', length => 75 }, + zipcode => { type => 'varchar', length => 10 }, + city => { type => 'varchar', length => 75 }, + country => { type => 'varchar', length => 75 }, + contact => { type => 'varchar', length => 75 }, + phone => { type => 'text' }, + fax => { type => 'varchar', length => 30 }, + homepage => { type => 'text' }, + email => { type => 'text' }, + notes => { type => 'text' }, + terms => { type => 'integer', default => '0' }, + taxincluded => { type => 'boolean' }, + vendornumber => { type => 'text' }, + cc => { type => 'text' }, + bcc => { type => 'text' }, + business_id => { type => 'integer' }, + taxnumber => { type => 'text' }, + discount => { type => 'float', precision => 4 }, + creditlimit => { type => 'numeric', precision => 5, scale => 15 }, + account_number => { type => 'varchar', length => 15 }, + bank_code => { type => 'varchar', length => 10 }, + bank => { type => 'text' }, + language => { type => 'varchar', length => 5 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + obsolete => { type => 'boolean', default => 'false' }, + username => { type => 'varchar', length => 50 }, + user_password => { type => 'varchar', length => 12 }, + salesman_id => { type => 'integer' }, + v_customer_id => { type => 'text' }, + language_id => { type => 'integer' }, + payment_id => { type => 'integer' }, + taxzone_id => { type => 'integer', default => '0', not_null => 1 }, + greeting => { type => 'text' }, + ustid => { type => 'varchar', length => 14 }, + direct_debit => { type => 'boolean', default => 'false' }, + iban => { type => 'varchar', length => 100 }, + bic => { type => 'varchar', length => 100 }, + currency_id => { type => 'integer', not_null => 1 }, +); - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - allow_inline_column_values => 1, +__PACKAGE__->meta->allow_inline_column_values(1); - foreign_keys => [ - business => { - class => 'SL::DB::Business', - key_columns => { business_id => 'id' }, - }, +__PACKAGE__->meta->foreign_keys( + business => { + class => 'SL::DB::Business', + key_columns => { business_id => 'id' }, + }, - currency => { - class => 'SL::DB::Currency', - key_columns => { currency_id => 'id' }, - }, + currency => { + class => 'SL::DB::Currency', + key_columns => { currency_id => 'id' }, + }, - language_obj => { - class => 'SL::DB::Language', - key_columns => { language_id => 'id' }, - }, + language_obj => { + class => 'SL::DB::Language', + key_columns => { language_id => 'id' }, + }, - payment => { - class => 'SL::DB::PaymentTerm', - key_columns => { payment_id => 'id' }, - }, - ], + payment => { + class => 'SL::DB::PaymentTerm', + key_columns => { payment_id => 'id' }, + }, ); +# __PACKAGE__->meta->initialize; + 1; ; diff --git a/SL/DB/MetaSetup/Warehouse.pm b/SL/DB/MetaSetup/Warehouse.pm index 0638b06cf..c75eb9f79 100644 --- a/SL/DB/MetaSetup/Warehouse.pm +++ b/SL/DB/MetaSetup/Warehouse.pm @@ -6,22 +6,22 @@ use strict; use base qw(SL::DB::Object); -__PACKAGE__->meta->setup( - table => 'warehouse', +__PACKAGE__->meta->table('warehouse'); - columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - description => { type => 'text' }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - sortkey => { type => 'integer' }, - invalid => { type => 'boolean' }, - ], +__PACKAGE__->meta->columns( + id => { type => 'integer', not_null => 1, sequence => 'id' }, + description => { type => 'text' }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + sortkey => { type => 'integer' }, + invalid => { type => 'boolean' }, +); - primary_key_columns => [ 'id' ], +__PACKAGE__->meta->primary_key_columns([ 'id' ]); - allow_inline_column_values => 1, -); +__PACKAGE__->meta->allow_inline_column_values(1); + +# __PACKAGE__->meta->initialize; 1; ; -- 2.20.1