import { Migration } from "@mikro-orm/migrations"; export class Migration20260217122512_meterageREquired extends Migration { override async up(): Promise { this.addSql(`alter table "company" alter column "metrage" type int using ("metrage"::int);`); this.addSql(`update "company" set "metrage" = 0 where "metrage" is null;`); this.addSql(`alter table "company" alter column "metrage" set not null;`); this.addSql(`alter table "invoice" alter column "total_price" type numeric using ("total_price"::numeric);`); this.addSql(`alter table "invoice" alter column "original_price" type numeric using ("original_price"::numeric);`); this.addSql(`alter table "invoice" alter column "tax" type numeric using ("tax"::numeric);`); this.addSql(`alter table "invoice" alter column "late_fee" type numeric using ("late_fee"::numeric);`); this.addSql(`alter table "payment" alter column "amount" type numeric using ("amount"::numeric);`); } override async down(): Promise { this.addSql(`alter table "company" alter column "metrage" type int4 using ("metrage"::int4);`); this.addSql(`alter table "company" alter column "metrage" drop not null;`); this.addSql(`alter table "invoice" alter column "total_price" type numeric using ("total_price"::numeric);`); this.addSql(`alter table "invoice" alter column "original_price" type numeric using ("original_price"::numeric);`); this.addSql(`alter table "invoice" alter column "tax" type numeric using ("tax"::numeric);`); this.addSql(`alter table "invoice" alter column "late_fee" type numeric using ("late_fee"::numeric);`); this.addSql(`alter table "payment" alter column "amount" type numeric using ("amount"::numeric);`); } }