Revision 96f8e8af
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/DB/MetaSetup/Reclamation.pm | ||
---|---|---|
31 | 31 |
notes => { type => 'text' }, |
32 | 32 |
payment_id => { type => 'integer' }, |
33 | 33 |
record_number => { type => 'text', not_null => 1 }, |
34 |
record_type => { type => 'enum', check_in => [ 'sales_reclamation', 'purchase_reclamation' ], db_type => 'reclamation_types', not_null => 1 }, |
|
34 | 35 |
reqdate => { type => 'date' }, |
35 | 36 |
salesman_id => { type => 'integer' }, |
36 | 37 |
shippingpoint => { type => 'text' }, |
sql/Pg-upgrade2/reclamation_type.sql | ||
---|---|---|
1 |
-- @tag: reclamation_type |
|
2 |
-- @description: Persistente Typen in Reklamationen |
|
3 |
-- @depends: release_3_7_0 |
|
4 |
|
|
5 |
CREATE TYPE reclamation_types AS ENUM ( |
|
6 |
'sales_reclamation', |
|
7 |
'purchase_reclamation' |
|
8 |
); |
|
9 |
|
|
10 |
ALTER TABLE reclamations ADD COLUMN record_type reclamation_types; |
|
11 |
|
|
12 |
UPDATE reclamations SET record_type = 'sales_reclamation' WHERE customer_id IS NOT NULL; |
|
13 |
UPDATE reclamations SET record_type = 'purchase_reclamation' WHERE vendor_id IS NOT NULL; |
|
14 |
|
|
15 |
ALTER TABLE reclamations ALTER COLUMN record_type SET NOT NULL; |
|
16 |
|
|
17 |
|
Auch abrufbar als: Unified diff
DB::Reclamation: Persistenter Record-Type