chore: locking-postgres provider dml (#10478)
This commit is contained in:
committed by
GitHub
parent
f65a3cc06d
commit
b0448a7c35
@@ -1,32 +1,9 @@
|
||||
import { generateEntityId } from "@medusajs/framework/utils"
|
||||
import {
|
||||
BeforeCreate,
|
||||
Entity,
|
||||
OnInit,
|
||||
PrimaryKey,
|
||||
Property,
|
||||
} from "@mikro-orm/core"
|
||||
import { model } from "@medusajs/framework/utils"
|
||||
|
||||
@Entity({ tableName: "locking" })
|
||||
class Locking {
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
id!: string
|
||||
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
owner_id: string | null = null
|
||||
|
||||
@Property({ columnType: "timestamptz", nullable: true })
|
||||
expiration: Date | null = null
|
||||
|
||||
@BeforeCreate()
|
||||
onCreate() {
|
||||
this.id = generateEntityId(this.id, "lk")
|
||||
}
|
||||
|
||||
@OnInit()
|
||||
onInit() {
|
||||
this.id = generateEntityId(this.id, "lk")
|
||||
}
|
||||
}
|
||||
const Locking = model.define("Locking", {
|
||||
id: model.id({ prefix: "lk" }).primaryKey(),
|
||||
owner_id: model.text().nullable(),
|
||||
expiration: model.dateTime().nullable(),
|
||||
})
|
||||
|
||||
export default Locking
|
||||
|
||||
Reference in New Issue
Block a user