X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44..53593baa211863fbf66540cf1bcc36c8fb37257f:/sql/Pg-upgrade2/assortment.sql

diff --git a/sql/Pg-upgrade2/assortment.sql b/sql/Pg-upgrade2/assortment.sql
new file mode 100644
index 000000000..5d9c68598
--- /dev/null
+++ b/sql/Pg-upgrade2/assortment.sql
@@ -0,0 +1,20 @@
+-- @tag: assortment_items
+-- @description: Sortimentsartikel eingefÃ¼hrt
+-- @depends: release_3_4_1 part_type_enum
+
+-- adding a new value isn't allowed inside a transaction, which is what DBUpgrade automatically does
+-- run this afterwards manually for now
+-- ALTER TYPE part_type_enum ADD VALUE 'assortment';
+
+CREATE TABLE assortment_items (
+  assortment_id INTEGER REFERENCES parts(id) ON DELETE CASCADE, -- the part id of the assortment
+  parts_id      INTEGER REFERENCES parts(id),
+  itime         timestamp without time zone default now(),
+  mtime         timestamp without time zone,
+  qty           REAL NOT NULL,
+  position      INTEGER NOT NULL,
+  unit          character varying(20) NOT NULL REFERENCES units(name),
+  CONSTRAINT assortment_part_pkey PRIMARY KEY (assortment_id, parts_id)
+);
+
+ALTER TABLE defaults ADD assortmentnumber TEXT;
