|
1
|
import { model } from "@medusajs/framework/utils" |
|
2
|
import ProductOptionValue from "./product-option-value" |
|
3
|
import ProductProductOption from "./product-product-option" |
|
4
|
|
|
5
|
/** |
|
6
|
* @since 2.16.0 |
|
7
|
*/ |
|
8
|
const ProductProductOptionValue = model |
|
9
|
.define("ProductProductOptionValue", { |
|
10
|
id: model.id({ prefix: "prodoptval" }).primaryKey(), |
|
11
|
product_product_option: model.belongsTo(() => ProductProductOption, { |
|
12
|
mappedBy: "values", |
|
13
|
}), |
|
14
|
product_option_value: model.belongsTo(() => ProductOptionValue, { |
|
15
|
mappedBy: "product_options", |
|
16
|
}), |
|
17
|
}) |
|
18
|
.indexes([ |
|
19
|
{ |
|
20
|
/** |
|
21
|
* Non-partial companion to the partial index generated for the |
|
22
|
* `product_product_option` relationship. Postgres runs the ON UPDATE / |
|
23
|
* ON DELETE CASCADE checks for this foreign key without a deleted_at |
|
24
|
* predicate, so it can only use an index that is not scoped to |
|
25
|
* `deleted_at IS NULL`. |
|
26
|
*/ |
|
27
|
name: "IDX_product_product_option_value_product_product_option_id_fk", |
|
28
|
on: ["product_product_option_id"], |
|
29
|
where: null, |
|
30
|
}, |
|
31
|
]) |
|
32
|
|
|
33
|
export default ProductProductOptionValue |