__PACKAGE__->meta->table('ar');
__PACKAGE__->meta->columns(
- amount => { type => 'numeric', precision => 15, scale => 5 },
+ amount => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
cp_id => { type => 'integer' },
currency_id => { type => 'integer', not_null => 1 },
cusordnumber => { type => 'text' },
marge_percent => { type => 'numeric', precision => 15, scale => 5 },
marge_total => { type => 'numeric', precision => 15, scale => 5 },
mtime => { type => 'timestamp' },
- netamount => { type => 'numeric', precision => 15, scale => 5 },
+ netamount => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
notes => { type => 'text' },
orddate => { type => 'date' },
ordnumber => { type => 'text' },
- paid => { type => 'numeric', precision => 15, scale => 5 },
+ paid => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
payment_id => { type => 'integer' },
quodate => { type => 'date' },
quonumber => { type => 'text' },
__PACKAGE__->meta->table('ap');
__PACKAGE__->meta->columns(
- amount => { type => 'numeric', precision => 15, scale => 5 },
+ amount => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
cp_id => { type => 'integer' },
currency_id => { type => 'integer', not_null => 1 },
datepaid => { type => 'date' },
itime => { type => 'timestamp', default => 'now()' },
language_id => { type => 'integer' },
mtime => { type => 'timestamp' },
- netamount => { type => 'numeric', precision => 15, scale => 5 },
+ netamount => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
notes => { type => 'text' },
orddate => { type => 'date' },
ordnumber => { type => 'text' },
- paid => { type => 'numeric', precision => 15, scale => 5 },
+ paid => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
payment_id => { type => 'integer' },
quodate => { type => 'date' },
quonumber => { type => 'text' },
--- /dev/null
+-- @tag: invoices_amount_paid_not_null
+-- @description: Bei Rechnungen die drei Spalten "amount", "netamount" und "paid" auf NOT NULL setzen
+-- @depends: release_3_2_0
+-- @encoding: utf-8
+
+UPDATE ar SET amount = 0 WHERE amount IS NULL;
+ALTER TABLE ar ALTER COLUMN amount SET NOT NULL;
+ALTER TABLE ar ALTER COLUMN amount SET DEFAULT 0;
+UPDATE ar SET netamount = 0 WHERE netamount IS NULL;
+ALTER TABLE ar ALTER COLUMN netamount SET NOT NULL;
+ALTER TABLE ar ALTER COLUMN netamount SET DEFAULT 0;
+UPDATE ar SET paid = 0 WHERE paid IS NULL;
+ALTER TABLE ar ALTER COLUMN paid SET NOT NULL;
+ALTER TABLE ar ALTER COLUMN paid SET DEFAULT 0;
+
+UPDATE ap SET amount = 0 WHERE amount IS NULL;
+ALTER TABLE ap ALTER COLUMN amount SET NOT NULL;
+ALTER TABLE ap ALTER COLUMN amount SET DEFAULT 0;
+UPDATE ap SET netamount = 0 WHERE netamount IS NULL;
+ALTER TABLE ap ALTER COLUMN netamount SET NOT NULL;
+ALTER TABLE ap ALTER COLUMN netamount SET DEFAULT 0;
+UPDATE ap SET paid = 0 WHERE paid IS NULL;
+ALTER TABLE ap ALTER COLUMN paid SET NOT NULL;
+ALTER TABLE ap ALTER COLUMN paid SET DEFAULT 0;