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' },
--- /dev/null
+-- @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;
+
+