Revision cfe2fc7f
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
scripts/rose_auto_create_model.pl | ||
---|---|---|
47 | 47 |
|
48 | 48 |
my %config; |
49 | 49 |
|
50 |
our %foreign_key_name_map = ( |
|
51 |
oe => { payment => 'payment_terms', }, |
|
52 |
ar => { payment => 'payment_terms', }, |
|
53 |
ap => { payment => 'payment_terms', }, |
|
54 |
|
|
55 |
orderitems => { parts => 'part', trans => 'order', }, |
|
56 |
delivery_order_items => { parts => 'part' }, |
|
57 |
invoice => { parts => 'part' }, |
|
58 |
follow_ups => { 'employee_obj' => 'created_for' }, |
|
59 |
|
|
60 |
periodic_invoices_configs => { oe => 'order' }, |
|
50 |
our %foreign_key_name_map = ( |
|
51 |
KIVITENDO => { |
|
52 |
oe => { payment => 'payment_terms', }, |
|
53 |
ar => { payment => 'payment_terms', }, |
|
54 |
ap => { payment => 'payment_terms', }, |
|
55 |
|
|
56 |
orderitems => { parts => 'part', trans => 'order', }, |
|
57 |
delivery_order_items => { parts => 'part' }, |
|
58 |
invoice => { parts => 'part' }, |
|
59 |
follow_ups => { 'employee_obj' => 'created_for' }, |
|
60 |
|
|
61 |
periodic_invoices_configs => { oe => 'order' }, |
|
62 |
}, |
|
61 | 63 |
); |
62 | 64 |
|
63 | 65 |
sub setup { |
... | ... | |
139 | 141 |
if ($foreign_key_definition && ($definition =~ /\Q$foreign_key_definition\E/)) { |
140 | 142 |
my ($start, $end) = ($-[0], $+[0]); |
141 | 143 |
|
142 |
while (my ($auto_generated_name, $desired_name) = each %{ $foreign_key_name_map{$table} || {} }) { |
|
144 |
my %changes = map { %{$_} } grep { $_ } ($foreign_key_name_map{$domain}->{ALL}, $foreign_key_name_map{$domain}->{$table}); |
|
145 |
while (my ($auto_generated_name, $desired_name) = each %changes) { |
|
143 | 146 |
$foreign_key_definition =~ s/^ \s \s ${auto_generated_name} \b/ ${desired_name}/msx; |
144 | 147 |
} |
145 | 148 |
|
Auch abrufbar als: Unified diff
Rose-Model-Generator: Foreign-Key-Namens-Mapping auf Datenbank beziehen