Pflichtenheftabschnittsvorlagen erzeugen, bearbeiten, löschen
[kivitendo-erp.git] / sql / Pg-upgrade2 / requirement_specs_section_templates.sql
1 -- @tag: requirement_specs_section_templates
2 -- @description: requirement_specs_section_templates
3 -- @depends: release_3_0_0 requirement_specs
4 -- @charset: utf-8
5
6 ALTER TABLE requirement_specs ALTER COLUMN type_id     DROP NOT NULL;
7 ALTER TABLE requirement_specs ALTER COLUMN status_id   DROP NOT NULL;
8 ALTER TABLE requirement_specs ALTER COLUMN customer_id DROP NOT NULL;
9
10 ALTER TABLE requirement_specs
11 ADD CONSTRAINT requirement_specs_is_template_or_has_customer_status_type
12 CHECK (
13     is_template
14  OR (    (type_id     IS NOT NULL)
15      AND (status_id   IS NOT NULL)
16      AND (customer_id IS NOT NULL))
17 );