committed by
GitHub
parent
cb79a5dbff
commit
d6ff526820
@@ -6,15 +6,15 @@ import {
|
||||
PlannerActionLinkDescriptor,
|
||||
} from "@medusajs/types"
|
||||
|
||||
import { generateEntity } from "../utils"
|
||||
import { EntitySchema, MikroORM } from "@mikro-orm/core"
|
||||
import { DatabaseSchema, PostgreSqlDriver } from "@mikro-orm/postgresql"
|
||||
import {
|
||||
arrayDifference,
|
||||
DALUtils,
|
||||
ModulesSdkUtils,
|
||||
arrayDifference,
|
||||
promiseAll,
|
||||
} from "@medusajs/utils"
|
||||
import { EntitySchema, MikroORM } from "@mikro-orm/core"
|
||||
import { DatabaseSchema, PostgreSqlDriver } from "@mikro-orm/postgresql"
|
||||
import { generateEntity } from "../utils"
|
||||
|
||||
/**
|
||||
* The migrations execution planner creates a plan of SQL queries
|
||||
@@ -125,7 +125,7 @@ export class MigrationsExecutionPlanner implements ILinkMigrationsPlanner {
|
||||
`
|
||||
)
|
||||
)
|
||||
.map(({ table_name }) => table_name)
|
||||
.map(({ table_name }) => table_name.toLowerCase())
|
||||
.filter((tableName) =>
|
||||
this.#linksEntities.some(
|
||||
({ entity }) => entity.meta.collection === tableName
|
||||
@@ -145,6 +145,7 @@ export class MigrationsExecutionPlanner implements ILinkMigrationsPlanner {
|
||||
const positionalArgs = new Array(existingTables.length)
|
||||
.fill("(?, ?)")
|
||||
.join(", ")
|
||||
|
||||
await orm.em
|
||||
.getDriver()
|
||||
.getConnection()
|
||||
@@ -223,7 +224,7 @@ export class MigrationsExecutionPlanner implements ILinkMigrationsPlanner {
|
||||
`)
|
||||
|
||||
return results.map((tuple) => ({
|
||||
table_name: tuple.table_name,
|
||||
table_name: tuple.table_name.toLowerCase(),
|
||||
link_descriptor: tuple.link_descriptor,
|
||||
}))
|
||||
}
|
||||
@@ -236,7 +237,7 @@ export class MigrationsExecutionPlanner implements ILinkMigrationsPlanner {
|
||||
entity: EntitySchema,
|
||||
trackedLinksTables: string[]
|
||||
): Promise<LinkMigrationsPlannerAction> {
|
||||
const tableName = entity.meta.collection
|
||||
const tableName = entity.meta.collection.toLowerCase()
|
||||
const orm = await this.createORM([entity])
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user