10 lines
428 B
TypeScript
10 lines
428 B
TypeScript
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;`);
|
|
}
|
|
|
|
}
|