Revision 377b7053
Von Jan Büren vor fast 11 Jahren hinzugefügt
SL/DB/Helper/Mappings.pm | ||
---|---|---|
84 | 84 |
my %kivitendo_package_names = ( |
85 | 85 |
# TABLE # MODEL (given in C style) |
86 | 86 |
acc_trans => 'acc_transaction', |
87 |
audittrail => 'audit_trail', |
|
87 | 88 |
'auth.clients' => 'auth_client', |
88 | 89 |
'auth.clients_users' => 'auth_client_user', |
89 | 90 |
'auth.clients_groups' => 'auth_client_group', |
SL/DB/MetaSetup/AuditTrail.pm | ||
---|---|---|
1 |
# This file has been auto-generated. Do not modify it; it will be overwritten |
|
2 |
# by rose_auto_create_model.pl automatically. |
|
3 |
package SL::DB::AuditTrail; |
|
4 |
|
|
5 |
use strict; |
|
6 |
|
|
7 |
use base qw(SL::DB::Object); |
|
8 |
|
|
9 |
__PACKAGE__->meta->table('audittrail'); |
|
10 |
|
|
11 |
__PACKAGE__->meta->columns( |
|
12 |
action => { type => 'text' }, |
|
13 |
employee_id => { type => 'integer' }, |
|
14 |
formname => { type => 'text' }, |
|
15 |
id => { type => 'serial', not_null => 1 }, |
|
16 |
reference => { type => 'text' }, |
|
17 |
tablename => { type => 'text' }, |
|
18 |
trans_id => { type => 'integer' }, |
|
19 |
transdate => { type => 'timestamp', default => 'now' }, |
|
20 |
); |
|
21 |
|
|
22 |
__PACKAGE__->meta->primary_key_columns([ 'id' ]); |
|
23 |
|
|
24 |
1; |
|
25 |
; |
SL/DB/MetaSetup/Customer.pm | ||
---|---|---|
89 | 89 |
class => 'SL::DB::PaymentTerm', |
90 | 90 |
key_columns => { payment_id => 'id' }, |
91 | 91 |
}, |
92 |
|
|
93 |
salesman => { |
|
94 |
class => 'SL::DB::Employee', |
|
95 |
key_columns => { salesman_id => 'id' }, |
|
96 |
}, |
|
97 | 92 |
); |
98 | 93 |
|
99 | 94 |
1; |
SL/DB/MetaSetup/Default.pm | ||
---|---|---|
18 | 18 |
ar_show_mark_as_paid => { type => 'boolean', default => 'true' }, |
19 | 19 |
articlenumber => { type => 'text' }, |
20 | 20 |
assemblynumber => { type => 'text' }, |
21 |
audittrail => { type => 'boolean', default => 'false' }, |
|
21 | 22 |
bin_id => { type => 'integer' }, |
22 | 23 |
bin_id_ignore_onhand => { type => 'integer' }, |
23 | 24 |
businessnumber => { type => 'text' }, |
SL/DB/MetaSetup/Vendor.pm | ||
---|---|---|
85 | 85 |
class => 'SL::DB::PaymentTerm', |
86 | 86 |
key_columns => { payment_id => 'id' }, |
87 | 87 |
}, |
88 |
|
|
89 |
salesman => { |
|
90 |
class => 'SL::DB::Employee', |
|
91 |
key_columns => { salesman_id => 'id' }, |
|
92 |
}, |
|
93 | 88 |
); |
94 | 89 |
|
95 | 90 |
1; |
sql/Pg-upgrade2/drop_audittrail.sql | ||
---|---|---|
1 |
-- @tag: drop_audittrail |
|
2 |
-- @description: Tabelle audittrail wird nicht mehr benutzt |
|
3 |
-- @depends: release_3_0_0 |
|
4 |
-- @ignore: 0 |
|
5 |
ALTER TABLE defaults DROP COLUMN audittrail; |
|
6 |
DROP TABLE audittrail; |
sql/Pg-upgrade2/employee_id_foreignkeys.pl | ||
---|---|---|
1 |
# @tag: employee_id_foreignkeys |
|
2 |
# @description: Falls ein Benutzer hart in der Datenbank gelöscht werden soll, entsprechende Fremdschlüssel setzen, entfernt ferner verwaiste Einträge |
|
3 |
# @depends: release_3_0_0 |
|
4 |
package SL::DBUpgrade2::employee_id_foreignkeys; |
|
5 |
|
|
6 |
use utf8; |
|
7 |
|
|
8 |
use parent qw(SL::DBUpgrade2::Base); |
|
9 |
use strict; |
|
10 |
|
|
11 |
sub run { |
|
12 |
my ($self) = @_; |
|
13 |
|
|
14 |
# this query will fail if we have orphaned entries |
|
15 |
# should only occur |
|
16 |
$self->db_query(qq|UPDATE customer set salesman_id = NULL where salesman_id not in (select id from employee)|, may_fail => 0); |
|
17 |
$self->db_query(qq|UPDATE vendor set salesman_id = NULL where salesman_id not in (select id from employee)|, may_fail => 0); |
|
18 |
$self->db_query(qq|ALTER TABLE customer ADD FOREIGN KEY (salesman_id) REFERENCES employee (id)|, may_fail => 0); |
|
19 |
$self->db_query(qq|ALTER TABLE vendor ADD FOREIGN KEY (salesman_id) REFERENCES employee (id)|, may_fail => 0); |
|
20 |
|
|
21 |
return 1; |
|
22 |
} |
|
23 |
|
|
24 |
1; |
Auch abrufbar als: Unified diff
Revert "Kleinere DB-Details (Fremdschlüssel und verwaiste Tabelle)"
This reverts commit d0118dc6303e04507a77f3dde2c2bf0565ecb388.