fix(index): Apply various fixes to the index engine (#12501)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { IndexTypes } from "@medusajs/framework/types"
|
||||
import { SqlEntityManager } from "@mikro-orm/postgresql"
|
||||
import { schemaObjectRepresentationPropertiesToOmit } from "@types"
|
||||
import { getPivotTableName, normalizeTableName } from "./normalze-table-name"
|
||||
|
||||
export async function createPartitions(
|
||||
schemaObjectRepresentation: IndexTypes.SchemaObjectRepresentation,
|
||||
@@ -18,7 +19,7 @@ export async function createPartitions(
|
||||
schemaObjectRepresentation[key].listeners.length > 0
|
||||
)
|
||||
.map((key) => {
|
||||
const cName = key.toLowerCase()
|
||||
const cName = normalizeTableName(key)
|
||||
|
||||
if (createdPartitions.has(cName)) {
|
||||
return []
|
||||
@@ -35,7 +36,8 @@ export async function createPartitions(
|
||||
continue
|
||||
}
|
||||
|
||||
const pName = `cat_pivot_${parent.ref.entity}${key}`.toLowerCase()
|
||||
const pName = getPivotTableName(`${parent.ref.entity}${key}`)
|
||||
|
||||
if (createdPartitions.has(pName)) {
|
||||
continue
|
||||
}
|
||||
@@ -63,7 +65,7 @@ export async function createPartitions(
|
||||
schemaObjectRepresentation[key].listeners.length > 0
|
||||
)
|
||||
.map((key) => {
|
||||
const cName = key.toLowerCase()
|
||||
const cName = normalizeTableName(key)
|
||||
const part: string[] = []
|
||||
|
||||
part.push(
|
||||
@@ -79,7 +81,8 @@ export async function createPartitions(
|
||||
continue
|
||||
}
|
||||
|
||||
const pName = `cat_pivot_${parent.ref.entity}${key}`.toLowerCase()
|
||||
const pName = getPivotTableName(`${parent.ref.entity}${key}`)
|
||||
|
||||
part.push(
|
||||
`CREATE INDEX CONCURRENTLY IF NOT EXISTS "IDX_${pName}_child_id" ON ${activeSchema}${pName} ("child_id")`
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user