From 095180009059dfec6d11e179fdb1bd6fc90f4b86 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 1 Oct 2021 16:34:34 +0200 Subject: [PATCH] DeliveryOrder order_type db upgrade is_sales noch nicht in der datenbank entfernt, nur im metasetup --- SL/DB/MetaSetup/DeliveryOrder.pm | 2 +- sql/Pg-upgrade2/deliveryorder_type.sql | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 sql/Pg-upgrade2/deliveryorder_type.sql diff --git a/SL/DB/MetaSetup/DeliveryOrder.pm b/SL/DB/MetaSetup/DeliveryOrder.pm index f24fc9f64..994fa96d7 100644 --- a/SL/DB/MetaSetup/DeliveryOrder.pm +++ b/SL/DB/MetaSetup/DeliveryOrder.pm @@ -23,11 +23,11 @@ __PACKAGE__->meta->columns( globalproject_id => { type => 'integer' }, id => { type => 'integer', not_null => 1, sequence => 'id' }, intnotes => { type => 'text' }, - is_sales => { type => 'boolean' }, itime => { type => 'timestamp', default => 'now()' }, language_id => { type => 'integer' }, mtime => { type => 'timestamp' }, notes => { type => 'text' }, + order_type => { type => 'text', not_null => 1 }, ordnumber => { type => 'text' }, oreqnumber => { type => 'text' }, payment_id => { type => 'integer' }, diff --git a/sql/Pg-upgrade2/deliveryorder_type.sql b/sql/Pg-upgrade2/deliveryorder_type.sql new file mode 100644 index 000000000..8e4a0f407 --- /dev/null +++ b/sql/Pg-upgrade2/deliveryorder_type.sql @@ -0,0 +1,12 @@ +-- @tag: deliveryorder_type +-- @description: Persistente Typen in Lieferscheinen +-- @depends: release_3_5_8 + +ALTER TABLE delivery_orders ADD COLUMN order_type TEXT; + +UPDATE delivery_orders SET order_type = 'sales_delivery_order' WHERE customer_id IS NOT NULL; +UPDATE delivery_orders SET order_type = 'purchase_delivery_order' WHERE vendor_id IS NOT NULL; + +ALTER TABLE delivery_orders ALTER COLUMN order_type SET NOT NULL; + + -- 2.20.1