breaking: rework how links database migrations are managed (#8162)

This commit is contained in:
Adrien de Peretti
2024-07-22 13:12:23 +05:30
committed by GitHub
parent f435c6c7f6
commit f74fdcb644
24 changed files with 1090 additions and 264 deletions
@@ -0,0 +1,44 @@
import {
defineJoinerConfig,
MedusaService,
model,
Module,
} from "@medusajs/utils"
export const User = model.define("user", {
id: model.id().primaryKey(),
name: model.text(),
})
export const Car = model.define("car", {
id: model.id().primaryKey(),
name: model.text(),
})
export const userJoinerConfig = defineJoinerConfig("User", {
models: [User],
})
export const carJoinerConfig = defineJoinerConfig("Car", {
models: [Car],
})
export class UserService extends MedusaService({ User }) {
constructor() {
super(...arguments)
}
}
export class CarService extends MedusaService({ Car }) {
constructor() {
super(...arguments)
}
}
export const UserModule = Module("User", {
service: UserService,
})
export const CarModule = Module("Car", {
service: CarService,
})