Raw
1 import { model } from "@medusajs/framework/utils"
2 import PriceList from "./price-list"
3
4 const PriceListRule = model
5 .define("PriceListRule", {
6 id: model.id({ prefix: "prule" }).primaryKey(),
7 attribute: model.text(),
8 value: model.json().nullable(),
9 price_list: model.belongsTo(() => PriceList, {
10 mappedBy: "price_list_rules",
11 }),
12 })
13 .indexes([
14 {
15 on: ["price_list_id"],
16 where: "deleted_at IS NULL",
17 },
18 {
19 on: ["attribute"],
20 where: "deleted_at IS NULL",
21 },
22 {
23 on: ["value"],
24 where: "deleted_at IS NULL",
25 type: "gin",
26 },
27 ])
28
29 export default PriceListRule