Files
medusa-store/packages/modules/product/src/migrations/Migration20250910154539.ts
Adrien de Peretti 356283c359 chore(): Accept an extra agument 'all-or-nothing' on the migrate command (#14262)
* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* Create rich-camels-brush.md

* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* chore(): fix broken down migrations

* chore(): update changeset
2025-12-10 09:23:41 +01:00

34 lines
1.4 KiB
TypeScript

import { Migration } from "@mikro-orm/migrations"
export class Migration20250910154539 extends Migration {
override async up(): Promise<void> {
this.addSql(
`CREATE INDEX IF NOT EXISTS "IDX_image_product_id" ON "image" (product_id) WHERE deleted_at IS NULL;`
)
this.addSql(
`CREATE INDEX IF NOT EXISTS "IDX_image_deleted_at" ON "image" (deleted_at) WHERE deleted_at IS NULL;`
)
this.addSql(
`CREATE INDEX IF NOT EXISTS "IDX_product_image_url" ON "image" (url) WHERE deleted_at IS NULL;`
)
this.addSql(
`CREATE INDEX IF NOT EXISTS "IDX_product_image_rank" ON "image" (rank) WHERE deleted_at IS NULL;`
)
this.addSql(
`CREATE INDEX IF NOT EXISTS "IDX_product_image_url_rank_product_id" ON "image" (url, rank, product_id) WHERE deleted_at IS NULL;`
)
this.addSql(
`CREATE INDEX IF NOT EXISTS "IDX_product_image_rank_product_id" ON "image" (rank, product_id) WHERE deleted_at IS NULL;`
)
}
override async down(): Promise<void> {
this.addSql(`drop index if exists "IDX_image_product_id";`)
this.addSql(`drop index if exists "IDX_image_deleted_at";`)
this.addSql(`drop index if exists "IDX_product_image_url";`)
this.addSql(`drop index if exists "IDX_product_image_rank";`)
this.addSql(`drop index if exists "IDX_product_image_url_rank_product_id";`)
this.addSql(`drop index if exists "IDX_product_image_rank_product_id";`)
}
}