import { Migration } from "@medusajs/framework/mikro-orm/migrations";

export class Migration20260321005658 extends Migration {

  override async up(): Promise<void> {
    this.addSql(`create table if not exists "quote" ("id" text not null, "reference" text not null, "status" text not null default 'saved', "customer_id" text not null, "customer_email" text not null, "cart_id" text not null, "currency_code" text null, "subtotal" integer null, "shipping_total" integer null, "total" integer null, "event_date" text null, "items_snapshot" text not null, "cart_snapshot" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "quote_pkey" primary key ("id"));`);
    this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_quote_deleted_at" ON "quote" ("deleted_at") WHERE deleted_at IS NULL;`);
  }

  override async down(): Promise<void> {
    this.addSql(`drop table if exists "quote" cascade;`);
  }

}
