import { Migration } from '@mikro-orm/migrations'; export class Migration20260628120000_DecimalQuantities extends Migration { override async up(): Promise { this.addSql(`alter table "order_items" alter column "quantity" type numeric(10,3) using "quantity"::numeric(10,3);`); this.addSql(`alter table "orders" alter column "total_items" type numeric(10,3) using "total_items"::numeric(10,3);`); this.addSql(`alter table "products" alter column "min_purchase_quantity" type numeric(10,3) using "min_purchase_quantity"::numeric(10,3);`); this.addSql(`alter table "products" alter column "max_purchase_quantity" type numeric(10,3) using "max_purchase_quantity"::numeric(10,3);`); this.addSql(`alter table "variants" alter column "stock" type numeric(10,3) using "stock"::numeric(10,3);`); } override async down(): Promise { this.addSql(`alter table "order_items" alter column "quantity" type int using round("quantity")::int;`); this.addSql(`alter table "orders" alter column "total_items" type int using round("total_items")::int;`); this.addSql(`alter table "products" alter column "min_purchase_quantity" type int using round("min_purchase_quantity")::int;`); this.addSql(`alter table "products" alter column "max_purchase_quantity" type int using round("max_purchase_quantity")::int;`); this.addSql(`alter table "variants" alter column "stock" type int using round("stock")::int;`); } }