From 57d97e2ba47a46a15a71b1fcbdd4d26bfc5205a3 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 11 Jul 2013 11:35:49 +0200 Subject: [PATCH] =?utf8?q?Defaultwerte=20f=C3=BCr=20itime-Spalten=20fixen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/MetaSetup/ProjectParticipant.pm | 4 +++- SL/DB/MetaSetup/ProjectPhase.pm | 4 +++- SL/DB/MetaSetup/ProjectPhaseParticipant.pm | 4 +++- SL/DB/MetaSetup/ProjectRole.pm | 4 +++- SL/DB/MetaSetup/ProjectStatus.pm | 4 +++- sql/Pg-upgrade2/project_bob_attributes.sql | 10 +++++----- .../project_bob_attributes_itime_default_fix.sql | 10 ++++++++++ 7 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 sql/Pg-upgrade2/project_bob_attributes_itime_default_fix.sql diff --git a/SL/DB/MetaSetup/ProjectParticipant.pm b/SL/DB/MetaSetup/ProjectParticipant.pm index 0f99ce6fd..92dbd1a14 100644 --- a/SL/DB/MetaSetup/ProjectParticipant.pm +++ b/SL/DB/MetaSetup/ProjectParticipant.pm @@ -12,7 +12,7 @@ __PACKAGE__->meta->columns( cost_per_hour => { type => 'numeric', precision => 5, scale => 15 }, employee_id => { type => 'integer', not_null => 1 }, id => { type => 'serial', not_null => 1 }, - itime => { type => 'timestamp', default => '2013-05-08 09:11:09.704126' }, + itime => { type => 'timestamp', default => 'now()' }, minutes => { type => 'integer', default => '0', not_null => 1 }, mtime => { type => 'timestamp' }, project_id => { type => 'integer', not_null => 1 }, @@ -21,6 +21,8 @@ __PACKAGE__->meta->columns( __PACKAGE__->meta->primary_key_columns([ 'id' ]); +__PACKAGE__->meta->allow_inline_column_values(1); + __PACKAGE__->meta->foreign_keys( employee => { class => 'SL::DB::Employee', diff --git a/SL/DB/MetaSetup/ProjectPhase.pm b/SL/DB/MetaSetup/ProjectPhase.pm index 7039a9cc1..a5fd71849 100644 --- a/SL/DB/MetaSetup/ProjectPhase.pm +++ b/SL/DB/MetaSetup/ProjectPhase.pm @@ -16,7 +16,7 @@ __PACKAGE__->meta->columns( general_cost_per_hour => { type => 'numeric', default => '0', not_null => 1, precision => 5, scale => 15 }, general_minutes => { type => 'integer', default => '0', not_null => 1 }, id => { type => 'serial', not_null => 1 }, - itime => { type => 'timestamp', default => '2013-05-08 09:11:09.704126' }, + itime => { type => 'timestamp', default => 'now()' }, mtime => { type => 'timestamp' }, name => { type => 'text', not_null => 1 }, project_id => { type => 'integer' }, @@ -25,6 +25,8 @@ __PACKAGE__->meta->columns( __PACKAGE__->meta->primary_key_columns([ 'id' ]); +__PACKAGE__->meta->allow_inline_column_values(1); + __PACKAGE__->meta->foreign_keys( project => { class => 'SL::DB::Project', diff --git a/SL/DB/MetaSetup/ProjectPhaseParticipant.pm b/SL/DB/MetaSetup/ProjectPhaseParticipant.pm index 6e9ca6b5a..837898032 100644 --- a/SL/DB/MetaSetup/ProjectPhaseParticipant.pm +++ b/SL/DB/MetaSetup/ProjectPhaseParticipant.pm @@ -12,7 +12,7 @@ __PACKAGE__->meta->columns( cost_per_hour => { type => 'numeric', precision => 5, scale => 15 }, employee_id => { type => 'integer', not_null => 1 }, id => { type => 'serial', not_null => 1 }, - itime => { type => 'timestamp', default => '2013-05-08 09:11:09.704126' }, + itime => { type => 'timestamp', default => 'now()' }, minutes => { type => 'integer', default => '0', not_null => 1 }, mtime => { type => 'timestamp' }, project_phase_id => { type => 'integer', not_null => 1 }, @@ -21,6 +21,8 @@ __PACKAGE__->meta->columns( __PACKAGE__->meta->primary_key_columns([ 'id' ]); +__PACKAGE__->meta->allow_inline_column_values(1); + __PACKAGE__->meta->foreign_keys( employee => { class => 'SL::DB::Employee', diff --git a/SL/DB/MetaSetup/ProjectRole.pm b/SL/DB/MetaSetup/ProjectRole.pm index 82385d3f5..efe93926f 100644 --- a/SL/DB/MetaSetup/ProjectRole.pm +++ b/SL/DB/MetaSetup/ProjectRole.pm @@ -11,7 +11,7 @@ __PACKAGE__->meta->table('project_roles'); __PACKAGE__->meta->columns( description => { type => 'text', not_null => 1 }, id => { type => 'serial', not_null => 1 }, - itime => { type => 'timestamp', default => '2013-05-08 09:11:09.704126' }, + itime => { type => 'timestamp', default => 'now()' }, mtime => { type => 'timestamp' }, name => { type => 'text', not_null => 1 }, position => { type => 'integer', not_null => 1 }, @@ -19,5 +19,7 @@ __PACKAGE__->meta->columns( __PACKAGE__->meta->primary_key_columns([ 'id' ]); +__PACKAGE__->meta->allow_inline_column_values(1); + 1; ; diff --git a/SL/DB/MetaSetup/ProjectStatus.pm b/SL/DB/MetaSetup/ProjectStatus.pm index be98f7b53..b79110a61 100644 --- a/SL/DB/MetaSetup/ProjectStatus.pm +++ b/SL/DB/MetaSetup/ProjectStatus.pm @@ -11,7 +11,7 @@ __PACKAGE__->meta->table('project_status'); __PACKAGE__->meta->columns( description => { type => 'text', not_null => 1 }, id => { type => 'serial', not_null => 1 }, - itime => { type => 'timestamp', default => '2013-05-08 09:11:09.704126' }, + itime => { type => 'timestamp', default => 'now()' }, mtime => { type => 'timestamp' }, name => { type => 'text', not_null => 1 }, position => { type => 'integer', not_null => 1 }, @@ -19,5 +19,7 @@ __PACKAGE__->meta->columns( __PACKAGE__->meta->primary_key_columns([ 'id' ]); +__PACKAGE__->meta->allow_inline_column_values(1); + 1; ; diff --git a/sql/Pg-upgrade2/project_bob_attributes.sql b/sql/Pg-upgrade2/project_bob_attributes.sql index cf7a2f357..d651f1038 100644 --- a/sql/Pg-upgrade2/project_bob_attributes.sql +++ b/sql/Pg-upgrade2/project_bob_attributes.sql @@ -22,7 +22,7 @@ CREATE TABLE project_status ( name TEXT NOT NULL, description TEXT NOT NULL, position INTEGER NOT NULL, - itime TIMESTAMP DEFAULT 'now()', + itime TIMESTAMP DEFAULT now(), mtime TIMESTAMP ); @@ -48,7 +48,7 @@ CREATE TABLE project_phases ( budget_cost NUMERIC (15,5) NOT NULL DEFAULT 0, general_minutes INTEGER NOT NULL DEFAULT 0, general_cost_per_hour NUMERIC (15,5) NOT NULL DEFAULT 0, - itime TIMESTAMP DEFAULT 'now()', + itime TIMESTAMP DEFAULT now(), mtime TIMESTAMP ); @@ -57,7 +57,7 @@ CREATE TABLE project_roles ( name TEXT NOT NULL, description TEXT NOT NULL, position INTEGER NOT NULL, - itime TIMESTAMP DEFAULT 'now()', + itime TIMESTAMP DEFAULT now(), mtime TIMESTAMP ); @@ -68,7 +68,7 @@ CREATE TABLE project_participants ( project_role_id INTEGER NOT NULL REFERENCES project_roles(id), minutes INTEGER NOT NULL DEFAULT 0, cost_per_hour NUMERIC (15,5), - itime TIMESTAMP DEFAULT 'now()', + itime TIMESTAMP DEFAULT now(), mtime TIMESTAMP ); @@ -79,7 +79,7 @@ CREATE TABLE project_phase_participants ( project_role_id INTEGER NOT NULL REFERENCES project_roles(id), minutes INTEGER NOT NULL DEFAULT 0, cost_per_hour NUMERIC (15,5), - itime TIMESTAMP DEFAULT 'now()', + itime TIMESTAMP DEFAULT now(), mtime TIMESTAMP ); diff --git a/sql/Pg-upgrade2/project_bob_attributes_itime_default_fix.sql b/sql/Pg-upgrade2/project_bob_attributes_itime_default_fix.sql new file mode 100644 index 000000000..190254ba1 --- /dev/null +++ b/sql/Pg-upgrade2/project_bob_attributes_itime_default_fix.sql @@ -0,0 +1,10 @@ +-- @tag: project_bob_attributes_itime_default_fix +-- @description: Standardwert für 'itime'-Spalten in Bob-Tabellen fixen +-- @depends: release_3_0_0 + +ALTER TABLE project ALTER COLUMN itime SET DEFAULT now(); +ALTER TABLE project_status ALTER COLUMN itime SET DEFAULT now(); +ALTER TABLE project_phases ALTER COLUMN itime SET DEFAULT now(); +ALTER TABLE project_roles ALTER COLUMN itime SET DEFAULT now(); +ALTER TABLE project_participants ALTER COLUMN itime SET DEFAULT now(); +ALTER TABLE project_phase_participants ALTER COLUMN itime SET DEFAULT now(); -- 2.20.1