chore(pricing): Pricing retrieval improvements (#12128)

**What**
I have removed the check for the context key where it was fetching all attributes available and then stripping out the one that does not exists.. On big dataset these would remove multiple hundreds of ms of query execution
This commit is contained in:
Adrien de Peretti authored and GitHub committed 2025-04-10 09:39:21 +00:00
1 parent 6ae1e7b708
commit 07252691c5
8 files changed
+671 -127

No files matched your search

@@ -795,6 +795,15 @@
"unique": false,
"expression": "CREATE UNIQUE INDEX IF NOT EXISTS \"IDX_price_rule_price_id_attribute_operator_unique\" ON \"price_rule\" (price_id, attribute, operator) WHERE deleted_at IS NULL"
},
{
"keyName": "IDX_price_rule_attribute",
"columnNames": [],
"composite": false,
"constraint": false,
"primary": false,
"unique": false,
"expression": "CREATE INDEX IF NOT EXISTS \"IDX_price_rule_attribute\" ON \"price_rule\" (attribute) WHERE deleted_at IS NULL"
},
{
"keyName": "IDX_price_rule_attribute_value",
"columnNames": [],
@@ -0,0 +1,13 @@
import { Migration } from '@mikro-orm/migrations';
export class Migration20250409122219 extends Migration {
override async up(): Promise<void> {
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_price_rule_attribute" ON "price_rule" (attribute) WHERE deleted_at IS NULL;`);
}
override async down(): Promise<void> {
this.addSql(`drop index if exists "IDX_price_rule_attribute";`);
}
}