Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / sql / Pg-upgrade2 / prices_unique.sql
1 -- @tag: prices_unique
2 -- @description: DB-Constraint - nur ein Preis pro Artikel pro Preisgruppe
3 -- @depends: release_3_4_1
4
5 -- it would be easier to just have a composite primary key on parts_id and
6 -- pricegroup_id, but that would need some code refactoring
7 ALTER TABLE prices ADD CONSTRAINT parts_id_pricegroup_id_unique UNIQUE (parts_id, pricegroup_id);
8 ALTER TABLE prices ALTER COLUMN parts_id SET NOT NULL;
9 ALTER TABLE prices ALTER COLUMN pricegroup_id SET NOT NULL;