invoice item total and subtotal

This commit is contained in:
2026-05-16 15:59:40 +03:30
parent 8017484f54
commit 7133b47c95
7 changed files with 58 additions and 17 deletions
@@ -0,0 +1,9 @@
import { Migration } from '@mikro-orm/migrations';
export class Migration20260516121012 extends Migration {
override async up(): Promise<void> {
this.addSql(`alter table "invoice_items" add column "sub_total" int generated always as (COALESCE(unit_price, 0) * quantity) STORED not null, add column "total" int generated always as ((COALESCE(unit_price, 0) * quantity) - COALESCE(discount, 0)) STORED not null;`);
}
}