Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 11f62590

Von Tamino Steinert vor 9 Monaten hinzugefügt

S:D:File: Objekttype auf Type Enum setzen

Unterschiede anzeigen:

SL/DB/MetaSetup/File.pm
19 19
  mime_type     => { type => 'text', not_null => 1 },
20 20
  mtime         => { type => 'timestamp' },
21 21
  object_id     => { type => 'integer', not_null => 1 },
22
  object_type   => { type => 'text', not_null => 1 },
22
  object_type   => { type => 'enum', check_in => [ 'sales_quotation', 'sales_order', 'sales_order_intake', 'request_quotation', 'purchase_quotation_intake', 'purchase_order', 'purchase_order_confirmation', 'sales_delivery_order', 'supplier_delivery_order', 'purchase_delivery_order', 'rma_delivery_order', 'invoice', 'invoice_for_advance_payment', 'final_invoice', 'credit_note', 'purchase_invoice', 'sales_reclamation', 'purchase_reclamation', 'dunning', 'dunning1', 'dunning2', 'dunning3', 'dunning_orig_invoice', 'dunning_invoice', 'customer', 'vendor', 'gl_transaction', 'part', 'shop_image', 'draft', 'letter', 'project', 'statement' ], db_type => 'file_object_types', not_null => 1 },
23 23
  print_variant => { type => 'text' },
24 24
  source        => { type => 'text', not_null => 1 },
25 25
  title         => { type => 'varchar', length => 45 },
sql/Pg-upgrade2/file_object_type_as_enum.sql
1
-- @tag: file_object_type_as_enum
2
-- @description: Objekttype von Dateien in Enum ändern
3
-- @depends: release_3_6_0
4

  
5
CREATE TYPE file_object_types AS ENUM (
6
  -- order
7
 'sales_quotation',
8
 'sales_order',
9
 'sales_order_intake',
10
 'request_quotation',
11
 'purchase_quotation_intake',
12
 'purchase_order',
13
 'purchase_order_confirmation',
14
  -- delivery_order
15
 'sales_delivery_order',
16
 'supplier_delivery_order',
17
 'purchase_delivery_order',
18
 'rma_delivery_order',
19
  -- invoice
20
 'invoice',
21
 'invoice_for_advance_payment',
22
 'final_invoice',
23
 'credit_note',
24
 'purchase_invoice',
25
  -- reclamation
26
 'sales_reclamation',
27
 'purchase_reclamation',
28
  -- dunning
29
 'dunning',
30
 'dunning1',
31
 'dunning2',
32
 'dunning3',
33
 'dunning_orig_invoice',
34
 'dunning_invoice',
35
  -- cv
36
 'customer',
37
 'vendor',
38
  -- other
39
 'gl_transaction',
40
 'part',
41
 'shop_image',
42
 'draft',
43
 'letter',
44
 'project',
45
 'statement'
46
);
47

  
48
ALTER TABLE files ADD    COLUMN object_type_new file_object_types;
49
UPDATE files SET object_type_new = object_type::file_object_types;
50
ALTER TABLE files ALTER  COLUMN object_type_new SET NOT NULL;
51
ALTER TABLE files DROP   COLUMN object_type;
52
ALTER TABLE files RENAME COLUMN object_type_new TO object_type;

Auch abrufbar als: Unified diff