Revision 36b8f1ec
Von Sven Schöling vor mehr als 9 Jahren hinzugefügt
SL/DB/MetaSetup/Invoice.pm | ||
---|---|---|
9 | 9 |
__PACKAGE__->meta->table('ar'); |
10 | 10 |
|
11 | 11 |
__PACKAGE__->meta->columns( |
12 |
amount => { type => 'numeric', precision => 15, scale => 5 }, |
|
12 |
amount => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
|
|
13 | 13 |
cp_id => { type => 'integer' }, |
14 | 14 |
currency_id => { type => 'integer', not_null => 1 }, |
15 | 15 |
cusordnumber => { type => 'text' }, |
... | ... | |
37 | 37 |
marge_percent => { type => 'numeric', precision => 15, scale => 5 }, |
38 | 38 |
marge_total => { type => 'numeric', precision => 15, scale => 5 }, |
39 | 39 |
mtime => { type => 'timestamp' }, |
40 |
netamount => { type => 'numeric', precision => 15, scale => 5 }, |
|
40 |
netamount => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
|
|
41 | 41 |
notes => { type => 'text' }, |
42 | 42 |
orddate => { type => 'date' }, |
43 | 43 |
ordnumber => { type => 'text' }, |
44 |
paid => { type => 'numeric', precision => 15, scale => 5 }, |
|
44 |
paid => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
|
|
45 | 45 |
payment_id => { type => 'integer' }, |
46 | 46 |
quodate => { type => 'date' }, |
47 | 47 |
quonumber => { type => 'text' }, |
SL/DB/MetaSetup/PurchaseInvoice.pm | ||
---|---|---|
9 | 9 |
__PACKAGE__->meta->table('ap'); |
10 | 10 |
|
11 | 11 |
__PACKAGE__->meta->columns( |
12 |
amount => { type => 'numeric', precision => 15, scale => 5 }, |
|
12 |
amount => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
|
|
13 | 13 |
cp_id => { type => 'integer' }, |
14 | 14 |
currency_id => { type => 'integer', not_null => 1 }, |
15 | 15 |
datepaid => { type => 'date' }, |
... | ... | |
28 | 28 |
itime => { type => 'timestamp', default => 'now()' }, |
29 | 29 |
language_id => { type => 'integer' }, |
30 | 30 |
mtime => { type => 'timestamp' }, |
31 |
netamount => { type => 'numeric', precision => 15, scale => 5 }, |
|
31 |
netamount => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
|
|
32 | 32 |
notes => { type => 'text' }, |
33 | 33 |
orddate => { type => 'date' }, |
34 | 34 |
ordnumber => { type => 'text' }, |
35 |
paid => { type => 'numeric', precision => 15, scale => 5 }, |
|
35 |
paid => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
|
|
36 | 36 |
payment_id => { type => 'integer' }, |
37 | 37 |
quodate => { type => 'date' }, |
38 | 38 |
quonumber => { type => 'text' }, |
sql/Pg-upgrade2/invoices_amount_paid_not_null.sql | ||
---|---|---|
1 |
-- @tag: invoices_amount_paid_not_null |
|
2 |
-- @description: Bei Rechnungen die drei Spalten "amount", "netamount" und "paid" auf NOT NULL setzen |
|
3 |
-- @depends: release_3_2_0 |
|
4 |
-- @encoding: utf-8 |
|
5 |
|
|
6 |
UPDATE ar SET amount = 0 WHERE amount IS NULL; |
|
7 |
ALTER TABLE ar ALTER COLUMN amount SET NOT NULL; |
|
8 |
ALTER TABLE ar ALTER COLUMN amount SET DEFAULT 0; |
|
9 |
UPDATE ar SET netamount = 0 WHERE netamount IS NULL; |
|
10 |
ALTER TABLE ar ALTER COLUMN netamount SET NOT NULL; |
|
11 |
ALTER TABLE ar ALTER COLUMN netamount SET DEFAULT 0; |
|
12 |
UPDATE ar SET paid = 0 WHERE paid IS NULL; |
|
13 |
ALTER TABLE ar ALTER COLUMN paid SET NOT NULL; |
|
14 |
ALTER TABLE ar ALTER COLUMN paid SET DEFAULT 0; |
|
15 |
|
|
16 |
UPDATE ap SET amount = 0 WHERE amount IS NULL; |
|
17 |
ALTER TABLE ap ALTER COLUMN amount SET NOT NULL; |
|
18 |
ALTER TABLE ap ALTER COLUMN amount SET DEFAULT 0; |
|
19 |
UPDATE ap SET netamount = 0 WHERE netamount IS NULL; |
|
20 |
ALTER TABLE ap ALTER COLUMN netamount SET NOT NULL; |
|
21 |
ALTER TABLE ap ALTER COLUMN netamount SET DEFAULT 0; |
|
22 |
UPDATE ap SET paid = 0 WHERE paid IS NULL; |
|
23 |
ALTER TABLE ap ALTER COLUMN paid SET NOT NULL; |
|
24 |
ALTER TABLE ap ALTER COLUMN paid SET DEFAULT 0; |
Auch abrufbar als: Unified diff
Rechnungen: amount, netamount, paid NOT NULL DEFAULT 0