import { Migration } from "@mikro-orm/migrations";
class Migration20260624120000_backfill_line_net_from_gross extends Migration {
  up() {
    for (const table of [
      "sales_order_lines",
      "sales_quote_lines",
      "sales_invoice_lines",
      "sales_credit_memo_lines"
    ]) {
      this.addSql(`
        update "${table}"
        set "total_net_amount" = round(
          "total_gross_amount" / (1 + coalesce("tax_rate", 0) / 100),
          4
        )
        where "total_gross_amount" > 0
          and ("total_net_amount" is null or "total_net_amount" <= 0);
      `);
    }
  }
  down() {
  }
}
export {
  Migration20260624120000_backfill_line_net_from_gross
};
//# sourceMappingURL=Migration20260624120000_backfill_line_net_from_gross.js.map
