feat(cart): Migration file (#6156)

* feat(cart): Migration file

* fixup migration

* Add indexes on cart table for currency, region, and sales channel

* fix indexes

* address PR comments
This commit is contained in:
Oli Juhl
2024-01-29 12:49:48 +01:00
committed by GitHub
parent 512b041929
commit c15438c744
10 changed files with 1530 additions and 261 deletions
+4 -1
View File
@@ -16,7 +16,10 @@ export default abstract class AdjustmentLine {
@Property({ columnType: "text", nullable: true })
description: string | null = null
@Property({ columnType: "text", nullable: true })
@Property({
columnType: "text",
nullable: true,
})
promotion_id: string | null = null
@Property({ columnType: "text", nullable: true })
+12 -4
View File
@@ -11,7 +11,7 @@ import {
OneToMany,
OptionalProps,
PrimaryKey,
Property
Property,
} from "@mikro-orm/core"
import Address from "./address"
import LineItem from "./line-item"
@@ -29,7 +29,11 @@ export default class Cart {
@PrimaryKey({ columnType: "text" })
id: string
@Property({ columnType: "text", nullable: true })
@Property({
columnType: "text",
nullable: true,
index: "IDX_cart_region_id",
})
region_id?: string | null
@Property({
@@ -39,13 +43,17 @@ export default class Cart {
})
customer_id?: string | null
@Property({ columnType: "text", nullable: true })
@Property({
columnType: "text",
nullable: true,
index: "IDX_cart_sales_channel_id",
})
sales_channel_id?: string | null
@Property({ columnType: "text", nullable: true })
email?: string | null
@Property({ columnType: "text" })
@Property({ columnType: "text", index: "IDX_cart_curency_code" })
currency_code: string
@Index({ name: "IDX_cart_shipping_address_id" })
+5 -1
View File
@@ -61,7 +61,11 @@ export default class LineItem {
})
variant_id?: string | null
@Property({ columnType: "text", nullable: true })
@Property({
columnType: "text",
nullable: true,
index: "IDX_line_item_product_id",
})
product_id?: string | null
@Property({ columnType: "text", nullable: true })
+5 -1
View File
@@ -43,7 +43,11 @@ export default class ShippingMethod {
@Property({ columnType: "boolean" })
is_tax_inclusive = false
@Property({ columnType: "text", nullable: true })
@Property({
columnType: "text",
nullable: true,
index: "IDX_shipping_method_option_id",
})
shipping_option_id?: string | null
@Property({ columnType: "jsonb", nullable: true })
+4 -1
View File
@@ -11,7 +11,10 @@ export default abstract class TaxLine {
@Property({ columnType: "text", nullable: true })
description?: string | null
@Property({ columnType: "text", nullable: true })
@Property({
columnType: "text",
nullable: true,
})
tax_rate_id?: string | null
@Property({ columnType: "text" })