From: Bernd Bleßmann Date: Fri, 8 May 2020 12:32:24 +0000 (+0200) Subject: Titel von Ansprechpersonen in eigene Tabelle: DB-Upgrade und Rose X-Git-Tag: release-3.5.6.1~205 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3a83d463cbe5330668715fed59d02e8b0842fc78;p=kivitendo-erp.git Titel von Ansprechpersonen in eigene Tabelle: DB-Upgrade und Rose --- diff --git a/SL/DB/ContactTitle.pm b/SL/DB/ContactTitle.pm new file mode 100644 index 000000000..427921445 --- /dev/null +++ b/SL/DB/ContactTitle.pm @@ -0,0 +1,13 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::ContactTitle; + +use strict; + +use SL::DB::MetaSetup::ContactTitle; +use SL::DB::Manager::ContactTitle; + +__PACKAGE__->meta->initialize; + +1; diff --git a/SL/DB/Helper/ALL.pm b/SL/DB/Helper/ALL.pm index 91f637860..5fd1d762e 100644 --- a/SL/DB/Helper/ALL.pm +++ b/SL/DB/Helper/ALL.pm @@ -27,6 +27,7 @@ use SL::DB::Buchungsgruppe; use SL::DB::Business; use SL::DB::Chart; use SL::DB::Contact; +use SL::DB::ContactTitle; use SL::DB::CsvImportProfile; use SL::DB::CsvImportProfileSetting; use SL::DB::CsvImportReport; diff --git a/SL/DB/Helper/Mappings.pm b/SL/DB/Helper/Mappings.pm index 30e41f309..6f5859642 100644 --- a/SL/DB/Helper/Mappings.pm +++ b/SL/DB/Helper/Mappings.pm @@ -110,6 +110,7 @@ my %kivitendo_package_names = ( bin => 'bin', business => 'business', chart => 'chart', + contact_titles => 'contact_title', contacts => 'contact', customer => 'customer', csv_import_profiles => 'csv_import_profile', diff --git a/SL/DB/Manager/ContactTitle.pm b/SL/DB/Manager/ContactTitle.pm new file mode 100644 index 000000000..f4119a8d1 --- /dev/null +++ b/SL/DB/Manager/ContactTitle.pm @@ -0,0 +1,14 @@ +# This file has been auto-generated only because it didn't exist. +# Feel free to modify it at will; it will not be overwritten automatically. + +package SL::DB::Manager::ContactTitle; + +use strict; + +use parent qw(SL::DB::Helper::Manager); + +sub object_class { 'SL::DB::ContactTitle' } + +__PACKAGE__->make_manager_methods; + +1; diff --git a/SL/DB/MetaSetup/ContactTitle.pm b/SL/DB/MetaSetup/ContactTitle.pm new file mode 100644 index 000000000..63006e9c3 --- /dev/null +++ b/SL/DB/MetaSetup/ContactTitle.pm @@ -0,0 +1,21 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::ContactTitle; + +use strict; + +use parent qw(SL::DB::Object); + +__PACKAGE__->meta->table('contact_titles'); + +__PACKAGE__->meta->columns( + description => { type => 'text', not_null => 1 }, + id => { type => 'serial', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->unique_keys([ 'description' ]); + +1; +; diff --git a/sql/Pg-upgrade2/contact_titles_own_table.sql b/sql/Pg-upgrade2/contact_titles_own_table.sql new file mode 100644 index 000000000..3fdaedbc8 --- /dev/null +++ b/sql/Pg-upgrade2/contact_titles_own_table.sql @@ -0,0 +1,15 @@ +-- @tag: contact_titles_own_table +-- @description: Eigene Tabelle für Titel bei Ansprechpersonen +-- @depends: release_3_5_5 + +CREATE TABLE contact_titles ( + id SERIAL, + description TEXT NOT NULL, + PRIMARY KEY (id), + UNIQUE (description) +); + +UPDATE contacts SET cp_title = trim(cp_title) WHERE cp_title NOT LIKE trim(cp_title); + +INSERT INTO contact_titles (description) + SELECT DISTINCT cp_title FROM contacts WHERE cp_title IS NOT NULL AND cp_title NOT LIKE '' ORDER BY cp_title;