chore(): Add missing product status index (#13475)

**What**
Add missing product status index
This commit is contained in:
Adrien de Peretti
2025-09-11 11:54:12 +02:00
committed by GitHub
parent 8dd9ae3d35
commit 58e20fa3fc
4 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/product": patch
---
chore(): Add missing product status index

View File

@@ -776,6 +776,15 @@
"unique": false,
"expression": "CREATE UNIQUE INDEX IF NOT EXISTS \"IDX_product_handle_unique\" ON \"product\" (handle) WHERE deleted_at IS NULL"
},
{
"keyName": "IDX_product_status",
"columnNames": [],
"composite": false,
"constraint": false,
"primary": false,
"unique": false,
"expression": "CREATE INDEX IF NOT EXISTS \"IDX_product_status\" ON \"product\" (status) WHERE deleted_at IS NULL"
},
{
"keyName": "product_pkey",
"columnNames": [

View File

@@ -0,0 +1,13 @@
import { Migration } from '@mikro-orm/migrations';
export class Migration20250911092221 extends Migration {
override async up(): Promise<void> {
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_product_status" ON "product" (status) WHERE deleted_at IS NULL;`);
}
override async down(): Promise<void> {
this.addSql(`drop index if exists "IDX_product_status";`);
}
}

View File

@@ -81,6 +81,12 @@ const Product = model
unique: false,
where: "deleted_at IS NULL",
},
{
name: "IDX_product_status",
on: ["status"],
unique: false,
where: "deleted_at IS NULL",
},
])
export default Product