chore(order): align mikroorm <> order module (#8710)
what: - aligns the order module migrations with mikroorm snapshot
This commit is contained in:
@@ -25,25 +25,26 @@ import LineItem from "./line-item"
|
||||
|
||||
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||
|
||||
const tableName = "order_claim_item"
|
||||
const ClaimIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_claim_item",
|
||||
tableName,
|
||||
columns: "claim_id",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ItemIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_claim_item",
|
||||
tableName,
|
||||
columns: "item_id",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_claim_item_image",
|
||||
tableName,
|
||||
columns: "deleted_at",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
@Entity({ tableName: "order_claim_item" })
|
||||
@Entity({ tableName })
|
||||
export default class OrderClaimItem {
|
||||
[OptionalProps]?: OptionalLineItemProps
|
||||
|
||||
|
||||
@@ -20,31 +20,32 @@ import Order from "./order"
|
||||
|
||||
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||
|
||||
const tableName = "order_item"
|
||||
const OrderIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_item",
|
||||
tableName,
|
||||
columns: ["order_id"],
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const OrderVersionIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_item",
|
||||
tableName,
|
||||
columns: ["version"],
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ItemIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_item",
|
||||
tableName,
|
||||
columns: ["item_id"],
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order",
|
||||
tableName,
|
||||
columns: "deleted_at",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
@Entity({ tableName: "order_item" })
|
||||
@Entity({ tableName })
|
||||
export default class OrderItem {
|
||||
[OptionalProps]?: OptionalLineItemProps
|
||||
|
||||
|
||||
@@ -21,49 +21,50 @@ import ShippingMethod from "./shipping-method"
|
||||
|
||||
type OptionalShippingMethodProps = DAL.ModelDateColumns
|
||||
|
||||
const tableName = "order_shipping"
|
||||
const OrderIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_shipping",
|
||||
tableName,
|
||||
columns: ["order_id"],
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ReturnIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_shipping",
|
||||
tableName,
|
||||
columns: "return_id",
|
||||
where: "return_id IS NOT NULL AND deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ExchangeIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_shipping",
|
||||
tableName,
|
||||
columns: ["exchange_id"],
|
||||
where: "exchange_id IS NOT NULL AND deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ClaimIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_shipping",
|
||||
tableName,
|
||||
columns: ["claim_id"],
|
||||
where: "claim_id IS NOT NULL AND deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const OrderVersionIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_shipping",
|
||||
tableName,
|
||||
columns: ["version"],
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ItemIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_shipping",
|
||||
tableName,
|
||||
columns: ["shipping_method_id"],
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order",
|
||||
tableName,
|
||||
columns: "deleted_at",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
@Entity({ tableName: "order_shipping" })
|
||||
@Entity({ tableName })
|
||||
export default class OrderShippingMethod {
|
||||
[OptionalProps]?: OptionalShippingMethodProps
|
||||
|
||||
|
||||
@@ -36,19 +36,21 @@ type OrderSummaryTotals = {
|
||||
refunded_total: BigNumber
|
||||
}
|
||||
|
||||
const tableName = "order_summary"
|
||||
|
||||
const OrderIdVersionIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_summary",
|
||||
tableName,
|
||||
columns: ["order_id", "version"],
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order",
|
||||
tableName,
|
||||
columns: "deleted_at",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
@Entity({ tableName: "order_summary" })
|
||||
@Entity({ tableName })
|
||||
@OrderIdVersionIndex.MikroORMIndex()
|
||||
export default class OrderSummary {
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
|
||||
@@ -19,31 +19,32 @@ import ReturnReason from "./return-reason"
|
||||
|
||||
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||
|
||||
const tableName = "return_item"
|
||||
const ReturnIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "return_item",
|
||||
tableName,
|
||||
columns: "return_id",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ReturnReasonIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "return_item",
|
||||
tableName,
|
||||
columns: "reason_id",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ItemIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "return_item",
|
||||
tableName,
|
||||
columns: "item_id",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_claim_item_image",
|
||||
tableName,
|
||||
columns: "deleted_at",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
@Entity({ tableName: "return_item" })
|
||||
@Entity({ tableName })
|
||||
export default class ReturnItem {
|
||||
[OptionalProps]?: OptionalLineItemProps
|
||||
|
||||
|
||||
@@ -24,55 +24,57 @@ import Return from "./return"
|
||||
|
||||
type OptionalLineItemProps = DAL.ModelDateColumns
|
||||
|
||||
const tableName = "order_transaction"
|
||||
|
||||
const ReferenceIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_transaction",
|
||||
tableName,
|
||||
columns: "reference_id",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const OrderIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_transaction",
|
||||
tableName,
|
||||
columns: "order_id",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ReturnIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_transaction",
|
||||
tableName,
|
||||
columns: "return_id",
|
||||
where: "return_id IS NOT NULL AND deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ExchangeIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_item",
|
||||
tableName,
|
||||
columns: ["exchange_id"],
|
||||
where: "exchange_id IS NOT NULL AND deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ClaimIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_item",
|
||||
tableName,
|
||||
columns: ["claim_id"],
|
||||
where: "claim_id IS NOT NULL AND deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const CurrencyCodeIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_transaction",
|
||||
tableName,
|
||||
columns: "currency_code",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const DeletedAtIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_transaction",
|
||||
tableName,
|
||||
columns: "deleted_at",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const OrderIdVersionIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_transaction",
|
||||
tableName,
|
||||
columns: ["order_id", "version"],
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
@Entity({ tableName: "order_transaction" })
|
||||
@Entity({ tableName })
|
||||
@Filter(DALUtils.mikroOrmSoftDeletableFilterOptions)
|
||||
@OrderIdVersionIndex.MikroORMIndex()
|
||||
export default class Transaction {
|
||||
|
||||
Reference in New Issue
Block a user