import { Migration } from "@mikro-orm/migrations";
class Migration20260215101500 extends Migration {
  async up() {
    this.addSql('alter table "catalog_product_variants" add column "option_values" jsonb null;');
    this.addSql(`
      update "catalog_product_variants"
      set "option_values" = "metadata" -> 'optionValues',
          "metadata" = nullif(("metadata" - 'optionValues'), '{}'::jsonb)
      where "metadata" ? 'optionValues';
    `);
  }
  async down() {
    this.addSql(`
      update "catalog_product_variants"
      set "metadata" = coalesce("metadata", '{}'::jsonb) || jsonb_build_object('optionValues', "option_values"),
          "option_values" = null
      where "option_values" is not null;
    `);
    this.addSql('alter table "catalog_product_variants" drop column "option_values";');
  }
}
export {
  Migration20260215101500
};
//# sourceMappingURL=Migration20260215101500.js.map
