up
This commit is contained in:
@@ -123,6 +123,7 @@ export class Migration20260626140000 extends Migration {
|
||||
$$ LANGUAGE plpgsql;
|
||||
`);
|
||||
|
||||
this.addSql(`DROP TRIGGER IF EXISTS trg_invoice_items_recalc ON invoice_items;`);
|
||||
this.addSql(`
|
||||
CREATE TRIGGER trg_invoice_items_recalc
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
@@ -131,6 +132,7 @@ export class Migration20260626140000 extends Migration {
|
||||
EXECUTE FUNCTION recalc_invoice_totals();
|
||||
`);
|
||||
|
||||
this.addSql(`DROP TRIGGER IF EXISTS trg_payments_recalc ON payments;`);
|
||||
this.addSql(`
|
||||
CREATE TRIGGER trg_payments_recalc
|
||||
AFTER INSERT OR UPDATE OR DELETE
|
||||
@@ -138,6 +140,12 @@ export class Migration20260626140000 extends Migration {
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION recalc_invoice_payments();
|
||||
`);
|
||||
|
||||
this.addSql(`
|
||||
UPDATE invoice_items
|
||||
SET quantity = quantity
|
||||
WHERE deleted_at IS NULL;
|
||||
`);
|
||||
}
|
||||
|
||||
override async down(): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user