chore(): Add missing product status index (#13475)
**What** Add missing product status index
This commit is contained in:
committed by
GitHub
parent
8dd9ae3d35
commit
58e20fa3fc
5
.changeset/smooth-plants-switch.md
Normal file
5
.changeset/smooth-plants-switch.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/product": patch
|
||||
---
|
||||
|
||||
chore(): Add missing product status index
|
||||
@@ -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": [
|
||||
|
||||
@@ -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";`);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user