**What** The module service name case has changed and the hash generation was performed on the non lower cased version of it while after the hash generation everything is based on the lower case version of the generated table name form the service names leading to different hash computation. This pr update the link migration table to adjust the to/from module value with its new value as well as generating the hash from the lower case version of the computed table name Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
79 lines
1.9 KiB
TypeScript
79 lines
1.9 KiB
TypeScript
import {
|
|
defineJoinerConfig,
|
|
MedusaService,
|
|
model,
|
|
Module,
|
|
} from "@medusajs/framework/utils"
|
|
|
|
export const User = model.define("user", {
|
|
id: model.id().primaryKey(),
|
|
name: model.text(),
|
|
})
|
|
|
|
export const userJoinerConfig = defineJoinerConfig("user", {
|
|
models: [User],
|
|
})
|
|
|
|
export class UserService extends MedusaService({ User }) {
|
|
constructor() {
|
|
super(...arguments)
|
|
}
|
|
}
|
|
|
|
export const UserModule = Module("user", {
|
|
service: UserService,
|
|
})
|
|
|
|
export const Car = model.define("car", {
|
|
id: model.id().primaryKey(),
|
|
name: model.text(),
|
|
})
|
|
|
|
export const carJoinerConfig = defineJoinerConfig("car", {
|
|
models: [Car],
|
|
})
|
|
|
|
export class CarService extends MedusaService({ Car }) {
|
|
constructor() {
|
|
super(...arguments)
|
|
}
|
|
}
|
|
|
|
export const CarModule = Module("car", {
|
|
service: CarService,
|
|
})
|
|
|
|
export const CustomModuleImplementationContainingAReallyBigNameThatExceedsPosgresLimitToNameATable =
|
|
model.define("very_long_table_name_of_custom_module", {
|
|
id: model.id().primaryKey(),
|
|
name: model.text(),
|
|
})
|
|
|
|
export const longNameJoinerConfig = defineJoinerConfig(
|
|
"CustomModuleImplementationContainingAReallyBigNameThatExceedsPosgresLimitToNameATable",
|
|
{
|
|
models: [
|
|
CustomModuleImplementationContainingAReallyBigNameThatExceedsPosgresLimitToNameATable,
|
|
],
|
|
}
|
|
)
|
|
|
|
export class CustomModuleImplementationContainingAReallyBigNameThatExceedsPosgresLimitToNameATableService extends MedusaService(
|
|
{
|
|
CustomModuleImplementationContainingAReallyBigNameThatExceedsPosgresLimitToNameATable,
|
|
}
|
|
) {
|
|
constructor() {
|
|
super(...arguments)
|
|
}
|
|
}
|
|
|
|
export const CustomModuleImplementationContainingAReallyBigNameThatExceedsPosgresLimitToNameATableModule =
|
|
Module(
|
|
"CustomModuleImplementationContainingAReallyBigNameThatExceedsPosgresLimitToNameATable",
|
|
{
|
|
service:
|
|
CustomModuleImplementationContainingAReallyBigNameThatExceedsPosgresLimitToNameATableService,
|
|
}
|
|
)
|