Revision 8dfd1885
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/DB/DeliveryOrder.pm | ||
---|---|---|
97 | 97 |
} |
98 | 98 |
|
99 | 99 |
sub type { |
100 |
goto &order_type;
|
|
100 |
goto &record_type;
|
|
101 | 101 |
} |
102 | 102 |
|
103 | 103 |
sub is_type { |
SL/DB/MetaSetup/DeliveryOrder.pm | ||
---|---|---|
27 | 27 |
language_id => { type => 'integer' }, |
28 | 28 |
mtime => { type => 'timestamp' }, |
29 | 29 |
notes => { type => 'text' }, |
30 |
order_type => { type => 'text', not_null => 1 }, |
|
31 | 30 |
ordnumber => { type => 'text' }, |
32 | 31 |
oreqnumber => { type => 'text' }, |
33 | 32 |
payment_id => { type => 'integer' }, |
33 |
record_type => { type => 'enum', check_in => [ 'sales_delivery_order', 'purchase_delivery_order', 'supplier_delivery_order', 'rma_delivery_order' ], db_type => 'delivery_order_types', not_null => 1 }, |
|
34 | 34 |
reqdate => { type => 'date' }, |
35 | 35 |
salesman_id => { type => 'integer' }, |
36 | 36 |
shippingpoint => { type => 'text' }, |
sql/Pg-upgrade2/deliveryorder_type_to_record_type.sql | ||
---|---|---|
1 |
-- @tag: deliveryorder_type_to_record_type |
|
2 |
-- @description: Convert deliveryorder_type to record_type enum |
|
3 |
-- @depends: deliveryorder_type |
|
4 |
|
|
5 |
CREATE TYPE delivery_order_types AS ENUM ( |
|
6 |
'sales_delivery_order', |
|
7 |
'purchase_delivery_order', |
|
8 |
'supplier_delivery_order', |
|
9 |
'rma_delivery_order' |
|
10 |
); |
|
11 |
|
|
12 |
ALTER TABLE delivery_orders ADD COLUMN record_type delivery_order_types; |
|
13 |
|
|
14 |
UPDATE delivery_orders SET record_type = 'sales_delivery_order' |
|
15 |
WHERE order_type = 'sales_delivery_order'; |
|
16 |
UPDATE delivery_orders SET record_type = 'purchase_delivery_order' |
|
17 |
WHERE order_type = 'purchase_delivery_order'; |
|
18 |
UPDATE delivery_orders SET record_type = 'supplier_delivery_order' |
|
19 |
WHERE order_type = 'supplier_delivery_order'; |
|
20 |
UPDATE delivery_orders SET record_type = 'rma_delivery_order' |
|
21 |
WHERE order_type = 'rma_delivery_order'; |
|
22 |
|
|
23 |
ALTER TABLE delivery_orders ALTER COLUMN record_type SET NOT NULL; |
|
24 |
ALTER TABLE delivery_orders DROP COLUMN order_type; |
Auch abrufbar als: Unified diff
DB::DeliveryOrder: Persistenter Record-Type