Raw
1 import { Migration } from "@medusajs/framework/mikro-orm/migrations";
2
3 export class Migration20250120110820 extends Migration {
4
5 async up(): Promise<void> {
6 this.addSql('alter table if exists "stock_location" drop constraint if exists "stock_location_address_id_unique";');
7 this.addSql('drop index if exists "IDX_stock_location_address_id";');
8 this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_stock_location_address_id_unique" ON "stock_location" (address_id) WHERE deleted_at IS NULL;');
9 }
10
11 async down(): Promise<void> {
12 this.addSql('drop index if exists "IDX_stock_location_address_id_unique";');
13 this.addSql('alter table if exists "stock_location" add constraint "stock_location_address_id_unique" unique ("address_id");');
14 this.addSql('CREATE INDEX IF NOT EXISTS "IDX_stock_location_address_id" ON "stock_location" (address_id) WHERE deleted_at IS NULL;');
15 }
16
17 }