1 import { model } from "@medusajs/framework/utils"
2 import PromotionRule from "./promotion-rule"
3
4 const PromotionRuleValue = model
5 .define(
6 { name: "PromotionRuleValue", tableName: "promotion_rule_value" },
7 {
8 id: model.id({ prefix: "prorulval" }).primaryKey(),
9 value: model.text(),
10 promotion_rule: model.belongsTo(() => PromotionRule, {
11 mappedBy: "values",
12 }),
13 }
14 )
15 .indexes([
16 {
17 name: "IDX_promotion_rule_value_rule_id_value",
18 on: ["promotion_rule_id", "value"],
19 unique: false,
20 where: "deleted_at IS NULL",
21 },
22 {
23 name: "IDX_promotion_rule_value_value",
24 on: ["value"],
25 unique: false,
26 where: "deleted_at IS NULL",
27 },
28 ])
29
30 export default PromotionRuleValue