From: Bernd Bleßmann Date: Mon, 28 Dec 2020 17:40:36 +0000 (+0100) Subject: Zeiterfassung: Auswählbare Artikel: DB-Upgrade und Rose X-Git-Tag: kivitendo-mebil_0.1-0~9^2~322 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=ae4cec429306e2f1372d9cbd7a2ac40ecb977869;p=kivitendo-erp.git Zeiterfassung: Auswählbare Artikel: DB-Upgrade und Rose --- diff --git a/SL/DB/Helper/ALL.pm b/SL/DB/Helper/ALL.pm index 52f132107..e0ab57845 100644 --- a/SL/DB/Helper/ALL.pm +++ b/SL/DB/Helper/ALL.pm @@ -135,6 +135,7 @@ use SL::DB::TaxKey; use SL::DB::TaxZone; use SL::DB::TaxzoneChart; use SL::DB::TimeRecording; +use SL::DB::TimeRecordingArticle; use SL::DB::TodoUserConfig; use SL::DB::TransferType; use SL::DB::Translation; diff --git a/SL/DB/Helper/Mappings.pm b/SL/DB/Helper/Mappings.pm index 7b69b53ec..94f7e4744 100644 --- a/SL/DB/Helper/Mappings.pm +++ b/SL/DB/Helper/Mappings.pm @@ -214,6 +214,7 @@ my %kivitendo_package_names = ( taxkeys => 'tax_key', tax_zones => 'tax_zone', taxzone_charts => 'taxzone_chart', + time_recording_articles => 'time_recording_article', time_recordings => 'time_recording', todo_user_config => 'todo_user_config', transfer_type => 'transfer_type', diff --git a/SL/DB/Manager/TimeRecordingArticle.pm b/SL/DB/Manager/TimeRecordingArticle.pm new file mode 100644 index 000000000..9f4b9e864 --- /dev/null +++ b/SL/DB/Manager/TimeRecordingArticle.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::TimeRecordingArticle; + +use strict; + +use parent qw(SL::DB::Helper::Manager); + +sub object_class { 'SL::DB::TimeRecordingArticle' } + +__PACKAGE__->make_manager_methods; + +1; diff --git a/SL/DB/MetaSetup/TimeRecording.pm b/SL/DB/MetaSetup/TimeRecording.pm index e35141b44..4fca65738 100644 --- a/SL/DB/MetaSetup/TimeRecording.pm +++ b/SL/DB/MetaSetup/TimeRecording.pm @@ -17,6 +17,7 @@ __PACKAGE__->meta->columns( id => { type => 'serial', not_null => 1 }, itime => { type => 'timestamp', default => 'now()', not_null => 1 }, mtime => { type => 'timestamp', default => 'now()', not_null => 1 }, + part_id => { type => 'integer' }, payroll => { type => 'boolean', default => 'false' }, project_id => { type => 'integer' }, staff_member_id => { type => 'integer', not_null => 1 }, @@ -38,6 +39,11 @@ __PACKAGE__->meta->foreign_keys( key_columns => { employee_id => 'id' }, }, + part => { + class => 'SL::DB::Part', + key_columns => { part_id => 'id' }, + }, + project => { class => 'SL::DB::Project', key_columns => { project_id => 'id' }, diff --git a/SL/DB/MetaSetup/TimeRecordingArticle.pm b/SL/DB/MetaSetup/TimeRecordingArticle.pm new file mode 100644 index 000000000..5d7bd8412 --- /dev/null +++ b/SL/DB/MetaSetup/TimeRecordingArticle.pm @@ -0,0 +1,30 @@ +# This file has been auto-generated. Do not modify it; it will be overwritten +# by rose_auto_create_model.pl automatically. +package SL::DB::TimeRecordingArticle; + +use strict; + +use parent qw(SL::DB::Object); + +__PACKAGE__->meta->table('time_recording_articles'); + +__PACKAGE__->meta->columns( + id => { type => 'serial', not_null => 1 }, + part_id => { type => 'integer', not_null => 1 }, + position => { type => 'integer', not_null => 1 }, +); + +__PACKAGE__->meta->primary_key_columns([ 'id' ]); + +__PACKAGE__->meta->unique_keys([ 'part_id' ]); + +__PACKAGE__->meta->foreign_keys( + part => { + class => 'SL::DB::Part', + key_columns => { part_id => 'id' }, + rel_type => 'one to one', + }, +); + +1; +; diff --git a/SL/DB/TimeRecordingArticle.pm b/SL/DB/TimeRecordingArticle.pm new file mode 100644 index 000000000..9887ce357 --- /dev/null +++ b/SL/DB/TimeRecordingArticle.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::TimeRecordingArticle; + +use strict; + +use SL::DB::MetaSetup::TimeRecordingArticle; +use SL::DB::Manager::TimeRecordingArticle; + +__PACKAGE__->meta->initialize; + +1; diff --git a/sql/Pg-upgrade2/time_recordings_articles.sql b/sql/Pg-upgrade2/time_recordings_articles.sql new file mode 100644 index 000000000..c693c3699 --- /dev/null +++ b/sql/Pg-upgrade2/time_recordings_articles.sql @@ -0,0 +1,13 @@ +-- @tag: time_recordings_articles +-- @description: Zeiterfassungs-Artikel +-- @depends: time_recordings + +CREATE TABLE time_recording_articles ( + id SERIAL, + part_id INTEGER REFERENCES parts(id) UNIQUE NOT NULL, + position INTEGER NOT NULL, + + PRIMARY KEY (id) +); + +ALTER TABLE time_recordings ADD COLUMN part_id INTEGER REFERENCES parts(id);