From 75563c5fd46b8e488431908ddd762d3190e628ad Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 2 Apr 2014 13:50:13 +0200 Subject: [PATCH] Pflichtenhefte: type_id darf nicht NULL sein --- SL/DB/MetaSetup/RequirementSpec.pm | 2 +- .../requirement_spec_type_for_template_fix.sql | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 sql/Pg-upgrade2/requirement_spec_type_for_template_fix.sql diff --git a/SL/DB/MetaSetup/RequirementSpec.pm b/SL/DB/MetaSetup/RequirementSpec.pm index 448816a88..667f39a6b 100644 --- a/SL/DB/MetaSetup/RequirementSpec.pm +++ b/SL/DB/MetaSetup/RequirementSpec.pm @@ -22,7 +22,7 @@ __PACKAGE__->meta->columns( status_id => { type => 'integer' }, time_estimation => { type => 'numeric', default => '0', not_null => 1, precision => 12, scale => 2 }, title => { type => 'text', not_null => 1 }, - type_id => { type => 'integer' }, + type_id => { type => 'integer', not_null => 1 }, working_copy_id => { type => 'integer' }, ); diff --git a/sql/Pg-upgrade2/requirement_spec_type_for_template_fix.sql b/sql/Pg-upgrade2/requirement_spec_type_for_template_fix.sql new file mode 100644 index 000000000..a7864390b --- /dev/null +++ b/sql/Pg-upgrade2/requirement_spec_type_for_template_fix.sql @@ -0,0 +1,11 @@ +-- @tag: requirement_spec_type_for_template_fix +-- @description: requirement_spec_type_for_template_fix +-- @depends: requirement_spec_types_number_formats +UPDATE requirement_specs +SET type_id = ( + SELECT MIN(id) + FROM requirement_spec_types +) +WHERE type_id IS NULL; + +ALTER TABLE requirement_specs ALTER COLUMN type_id SET NOT NULL; -- 2.20.1