X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44..53593baa211863fbf66540cf1bcc36c8fb37257f:/sql/Pg-upgrade2/prices_unique.sql diff --git a/sql/Pg-upgrade2/prices_unique.sql b/sql/Pg-upgrade2/prices_unique.sql new file mode 100644 index 000000000..f086283c9 --- /dev/null +++ b/sql/Pg-upgrade2/prices_unique.sql @@ -0,0 +1,9 @@ +-- @tag: prices_unique +-- @description: DB-Constraint - nur ein Preis pro Artikel pro Preisgruppe +-- @depends: release_3_4_1 + +-- it would be easier to just have a composite primary key on parts_id and +-- pricegroup_id, but that would need some code refactoring +ALTER TABLE prices ADD CONSTRAINT parts_id_pricegroup_id_unique UNIQUE (parts_id, pricegroup_id); +ALTER TABLE prices ALTER COLUMN parts_id SET NOT NULL; +ALTER TABLE prices ALTER COLUMN pricegroup_id SET NOT NULL;