X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/58265754620f2c93d858a062eadfd3e16812099c..c4563766e64c6ac8aeb460acd386dea8201a10a1:/sql/Pg-upgrade2/warehouse2.sql

diff --git a/sql/Pg-upgrade2/warehouse2.sql b/sql/Pg-upgrade2/warehouse2.sql
new file mode 100644
index 000000000..8d8e1b367
--- /dev/null
+++ b/sql/Pg-upgrade2/warehouse2.sql
@@ -0,0 +1,5 @@
+-- @tag: warehouse2
+-- @description: Defaultwert für onhand
+-- @depends: warehouse
+UPDATE parts SET onhand = COALESCE((SELECT SUM(qty) FROM inventory WHERE inventory.parts_id = parts.id), 0);
+ALTER TABLE parts ALTER COLUMN onhand SET DEFAULT 0;
