Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 79c0cb3e

Von Moritz Bunkus vor mehr als 5 Jahren hinzugefügt

  • ID 79c0cb3ee3c502c560d4b541eeb5e662fe50bbbd
  • Vorgänger cb397ea3
  • Nachfolger da2df61a

Mahnungs-Tabelle: Fremdschlüsselverknüpfung auf Rechnungstabelle

Unterschiede anzeigen:

SL/DB/MetaSetup/Dunning.pm
33 33
    key_columns => { dunning_config_id => 'id' },
34 34
  },
35 35

  
36
  fee_interest_ar => {
36
  fee_interest_invoice => {
37 37
    class       => 'SL::DB::Invoice',
38 38
    key_columns => { fee_interest_ar_id => 'id' },
39 39
  },
40

  
41
  invoice => {
42
    class       => 'SL::DB::Invoice',
43
    key_columns => { trans_id => 'id' },
44
  },
40 45
);
41 46

  
42 47
1;
scripts/rose_auto_create_model.pl
82 82

  
83 83
    assembly                  => { parts_id => 'part', id => 'assembly_part' },
84 84
    assortment_items          => { parts_id => 'part' },
85

  
86
    dunning                   => { trans_id => 'invoice', fee_interest_ar_id => 'fee_interest_invoice' },
85 87
  },
86 88
);
87 89

  
sql/Pg-upgrade2/dunning_foreign_key_for_trans_id.sql
1
-- @tag: dunning_foreign_key_for_trans_id
2
-- @description: Mahnungstabelle: Fremdschlüssel für Verknüpfung zur Rechnungstabelle
3
-- @depends: release_3_5_3
4
DELETE FROM dunning
5
WHERE NOT EXISTS (
6
  SELECT ar.id
7
  FROM ar
8
  WHERE ar.id = dunning.trans_id
9
);
10

  
11
ALTER TABLE dunning
12
ADD CONSTRAINT dunning_trans_id_fkey
13
FOREIGN KEY (trans_id) REFERENCES ar (id)
14
ON DELETE CASCADE;

Auch abrufbar als: Unified diff