chore(core-flows): adjust inventory when return is received (#8222)

This commit is contained in:
Carlos R. L. Rodrigues
2024-07-23 13:36:46 -03:00
committed by GitHub
parent f38f6d53b4
commit 7a5349c0ae
20 changed files with 579 additions and 286 deletions
@@ -1,6 +1,6 @@
import { CreateOrderDTO, IOrderModuleService } from "@medusajs/types"
import { moduleIntegrationTestRunner } from "medusa-test-utils"
import { Modules } from "@medusajs/utils"
import { moduleIntegrationTestRunner } from "medusa-test-utils"
jest.setTimeout(100000)
@@ -132,7 +132,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
billing_address: expect.objectContaining({
id: expect.stringContaining("ordaddr_"),
}),
items: [
items: expect.arrayContaining([
expect.objectContaining({
id: expect.stringContaining("ordli_"),
quantity: 1,
@@ -174,7 +174,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
version: 1,
}),
}),
],
]),
shipping_methods: [
expect.objectContaining({
id: expect.stringContaining("ordsm_"),
@@ -104,6 +104,9 @@ moduleIntegrationTestRunner({
it("should claim an item and add two new items to the order", async function () {
const createdOrder = await service.createOrders(input)
createdOrder.items = createdOrder.items!.sort((a, b) =>
a.title.localeCompare(b.title)
)
// Fullfilment
await service.registerFulfillment({
@@ -127,6 +127,9 @@ moduleIntegrationTestRunner<IOrderModuleService>({
it("should change an order by adding actions to it", async function () {
const createdOrder = await service.createOrders(input)
createdOrder.items = createdOrder.items!.sort((a, b) =>
a.title.localeCompare(b.title)
)
await service.addOrderAction([
{
@@ -219,123 +222,131 @@ moduleIntegrationTestRunner<IOrderModuleService>({
],
relations: ["items", "shipping_methods", "transactions"],
})
const serializedFinalOrder = JSON.parse(JSON.stringify(finalOrder))
const serializedCreatedOrder = JSON.parse(JSON.stringify(createdOrder))
expect(serializedCreatedOrder.items).toEqual([
expect.objectContaining({
title: "Item 1",
unit_price: 8,
quantity: 1,
detail: expect.objectContaining({
version: 1,
expect(serializedCreatedOrder.items).toEqual(
expect.arrayContaining([
expect.objectContaining({
title: "Item 1",
unit_price: 8,
quantity: 1,
fulfilled_quantity: 0,
shipped_quantity: 0,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 0,
written_off_quantity: 0,
detail: expect.objectContaining({
version: 1,
quantity: 1,
fulfilled_quantity: 0,
shipped_quantity: 0,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 0,
written_off_quantity: 0,
}),
}),
}),
expect.objectContaining({
title: "Item 2",
compare_at_unit_price: null,
unit_price: 5,
quantity: 2,
}),
expect.objectContaining({
title: "Item 3",
unit_price: 30,
quantity: 1,
detail: expect.objectContaining({
version: 1,
expect.objectContaining({
title: "Item 2",
compare_at_unit_price: null,
unit_price: 5,
quantity: 2,
}),
expect.objectContaining({
title: "Item 3",
unit_price: 30,
quantity: 1,
fulfilled_quantity: 0,
shipped_quantity: 0,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 0,
written_off_quantity: 0,
detail: expect.objectContaining({
version: 1,
quantity: 1,
fulfilled_quantity: 0,
shipped_quantity: 0,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 0,
written_off_quantity: 0,
}),
}),
}),
])
])
)
expect(serializedFinalOrder).toEqual(
expect.objectContaining({
version: 1,
})
)
expect(serializedFinalOrder.items).toEqual([
expect.objectContaining({
title: "Item 1",
subtitle: "Subtitle 1",
thumbnail: "thumbnail1.jpg",
variant_id: "variant1",
product_id: "product1",
product_title: "Product 1",
product_description: "Description 1",
product_subtitle: "Product Subtitle 1",
product_type: "Type 1",
product_collection: "Collection 1",
product_handle: "handle1",
variant_sku: "SKU1",
variant_barcode: "Barcode1",
variant_title: "Variant 1",
variant_option_values: { size: "Large", color: "Red" },
requires_shipping: true,
is_discountable: true,
is_tax_inclusive: true,
compare_at_unit_price: 10,
unit_price: 8,
quantity: 2,
detail: expect.objectContaining({
version: 1,
expect(serializedFinalOrder.items).toEqual(
expect.arrayContaining([
expect.objectContaining({
title: "Item 1",
subtitle: "Subtitle 1",
thumbnail: "thumbnail1.jpg",
variant_id: "variant1",
product_id: "product1",
product_title: "Product 1",
product_description: "Description 1",
product_subtitle: "Product Subtitle 1",
product_type: "Type 1",
product_collection: "Collection 1",
product_handle: "handle1",
variant_sku: "SKU1",
variant_barcode: "Barcode1",
variant_title: "Variant 1",
variant_option_values: { size: "Large", color: "Red" },
requires_shipping: true,
is_discountable: true,
is_tax_inclusive: true,
compare_at_unit_price: 10,
unit_price: 8,
quantity: 2,
fulfilled_quantity: 0,
shipped_quantity: 0,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 0,
written_off_quantity: 0,
detail: expect.objectContaining({
version: 1,
quantity: 2,
fulfilled_quantity: 0,
shipped_quantity: 0,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 0,
written_off_quantity: 0,
}),
}),
}),
expect.objectContaining({
title: "Item 2",
compare_at_unit_price: null,
unit_price: 5,
quantity: 5,
detail: expect.objectContaining({
version: 1,
expect.objectContaining({
title: "Item 2",
compare_at_unit_price: null,
unit_price: 5,
quantity: 5,
fulfilled_quantity: 0,
shipped_quantity: 0,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 0,
written_off_quantity: 0,
detail: expect.objectContaining({
version: 1,
quantity: 5,
fulfilled_quantity: 0,
shipped_quantity: 0,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 0,
written_off_quantity: 0,
}),
}),
}),
expect.objectContaining({
title: "Item 3",
unit_price: 30,
quantity: 1,
detail: expect.objectContaining({
version: 1,
expect.objectContaining({
title: "Item 3",
unit_price: 30,
quantity: 1,
fulfilled_quantity: 1,
shipped_quantity: 1,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 1,
written_off_quantity: 1,
detail: expect.objectContaining({
version: 1,
quantity: 1,
fulfilled_quantity: 1,
shipped_quantity: 1,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 1,
written_off_quantity: 1,
}),
}),
}),
])
])
)
})
it("should create an order change, add actions to it, confirm the changes, revert all the changes and restore the changes again.", async function () {
const createdOrder = await service.createOrders(input)
createdOrder.items = createdOrder.items!.sort((a, b) =>
a.title.localeCompare(b.title)
)
const orderChange = await service.createOrderChange({
order_id: createdOrder.id,
@@ -439,45 +450,47 @@ moduleIntegrationTestRunner<IOrderModuleService>({
expect(serializedModifiedOrder.shipping_methods).toHaveLength(1)
expect(serializedModifiedOrder.shipping_methods[0].amount).toEqual(10)
expect(serializedModifiedOrder.items).toEqual([
expect.objectContaining({
quantity: 2,
detail: expect.objectContaining({
version: 2,
expect(serializedModifiedOrder.items).toEqual(
expect.arrayContaining([
expect.objectContaining({
quantity: 2,
detail: expect.objectContaining({
version: 2,
quantity: 2,
}),
}),
}),
expect.objectContaining({
title: "Item 2",
unit_price: 5,
quantity: 5,
detail: expect.objectContaining({
version: 2,
expect.objectContaining({
title: "Item 2",
unit_price: 5,
quantity: 5,
fulfilled_quantity: 0,
shipped_quantity: 0,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 0,
written_off_quantity: 0,
detail: expect.objectContaining({
version: 2,
quantity: 5,
fulfilled_quantity: 0,
shipped_quantity: 0,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 0,
written_off_quantity: 0,
}),
}),
}),
expect.objectContaining({
title: "Item 3",
unit_price: 30,
quantity: 1,
detail: expect.objectContaining({
version: 2,
expect.objectContaining({
title: "Item 3",
unit_price: 30,
quantity: 1,
fulfilled_quantity: 1,
shipped_quantity: 1,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 1,
written_off_quantity: 1,
detail: expect.objectContaining({
version: 2,
quantity: 1,
fulfilled_quantity: 1,
shipped_quantity: 1,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 1,
written_off_quantity: 1,
}),
}),
}),
])
])
)
// Revert Last Changes
await service.revertLastVersion(createdOrder.id)
@@ -504,50 +517,55 @@ moduleIntegrationTestRunner<IOrderModuleService>({
expect(serializedRevertedOrder.shipping_methods).toHaveLength(1)
expect(serializedRevertedOrder.shipping_methods[0].amount).toEqual(10)
expect(serializedRevertedOrder.items).toEqual([
expect.objectContaining({
quantity: 1,
unit_price: 8,
detail: expect.objectContaining({
version: 1,
expect(serializedRevertedOrder.items).toEqual(
expect.arrayContaining([
expect.objectContaining({
quantity: 1,
unit_price: 8,
detail: expect.objectContaining({
version: 1,
quantity: 1,
}),
}),
}),
expect.objectContaining({
title: "Item 2",
unit_price: 5,
quantity: 2,
detail: expect.objectContaining({
version: 1,
expect.objectContaining({
title: "Item 2",
unit_price: 5,
quantity: 2,
fulfilled_quantity: 0,
shipped_quantity: 0,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 0,
written_off_quantity: 0,
detail: expect.objectContaining({
version: 1,
quantity: 2,
fulfilled_quantity: 0,
shipped_quantity: 0,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 0,
written_off_quantity: 0,
}),
}),
}),
expect.objectContaining({
title: "Item 3",
unit_price: 30,
quantity: 1,
detail: expect.objectContaining({
version: 1,
expect.objectContaining({
title: "Item 3",
unit_price: 30,
quantity: 1,
fulfilled_quantity: 0,
shipped_quantity: 0,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 0,
written_off_quantity: 0,
detail: expect.objectContaining({
version: 1,
quantity: 1,
fulfilled_quantity: 0,
shipped_quantity: 0,
return_requested_quantity: 0,
return_received_quantity: 0,
return_dismissed_quantity: 0,
written_off_quantity: 0,
}),
}),
}),
])
])
)
})
it("should create order change, cancel and reject them.", async function () {
const createdOrder = await service.createOrders(input)
createdOrder.items = createdOrder.items!.sort((a, b) =>
a.title.localeCompare(b.title)
)
const orderChange = await service.createOrderChange({
order_id: createdOrder.id,
@@ -104,6 +104,9 @@ moduleIntegrationTestRunner({
it("should exchange an item and add two new items to the order", async function () {
const createdOrder = await service.createOrders(input)
createdOrder.items = createdOrder.items!.sort((a, b) =>
a.title.localeCompare(b.title)
)
// Fullfilment
await service.registerFulfillment({
@@ -104,6 +104,9 @@ moduleIntegrationTestRunner<IOrderModuleService>({
it("should create an order, fulfill, ship and return the items", async function () {
const createdOrder = await service.createOrders(input)
createdOrder.items = createdOrder.items!.sort((a, b) =>
a.title.localeCompare(b.title)
)
// Fullfilment
await service.registerFulfillment({
@@ -135,7 +138,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
expect(serializedOrder).toEqual(
expect.objectContaining({
items: [
items: expect.arrayContaining([
expect.objectContaining({
quantity: 1,
detail: expect.objectContaining({
@@ -160,7 +163,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
shipped_quantity: 0,
}),
}),
],
]),
})
)
@@ -195,7 +198,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
expect(serializedOrder).toEqual(
expect.objectContaining({
items: [
items: expect.arrayContaining([
expect.objectContaining({
quantity: 1,
detail: expect.objectContaining({
@@ -220,7 +223,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
shipped_quantity: 1,
}),
}),
],
]),
})
)
@@ -290,7 +293,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
expect(serializedOrder.shipping_methods).toHaveLength(3)
expect(serializedOrder).toEqual(
expect.objectContaining({
items: [
items: expect.arrayContaining([
expect.objectContaining({
quantity: 1,
detail: expect.objectContaining({
@@ -318,7 +321,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
return_requested_quantity: 1,
}),
}),
],
]),
})
)
@@ -443,7 +446,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
expect(serializedOrder).toEqual(
expect.objectContaining({
items: [
items: expect.arrayContaining([
expect.objectContaining({
quantity: 1,
detail: expect.objectContaining({
@@ -474,13 +477,16 @@ moduleIntegrationTestRunner<IOrderModuleService>({
return_received_quantity: 1,
}),
}),
],
]),
})
)
})
it("should create an order, fulfill, return the items and cancel some item return", async function () {
const createdOrder = await service.createOrders(input)
createdOrder.items = createdOrder.items!.sort((a, b) =>
a.title.localeCompare(b.title)
)
await service.registerFulfillment({
order_id: createdOrder.id,
@@ -553,7 +559,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
expect(serializedOrder).toEqual(
expect.objectContaining({
items: [
items: expect.arrayContaining([
expect.objectContaining({
quantity: 1,
detail: expect.objectContaining({
@@ -578,7 +584,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
return_requested_quantity: 1,
}),
}),
],
]),
})
)
@@ -628,7 +634,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
expect(serializedOrder.shipping_methods).toHaveLength(2)
expect(serializedOrder).toEqual(
expect.objectContaining({
items: [
items: expect.arrayContaining([
expect.objectContaining({
quantity: 1,
detail: expect.objectContaining({
@@ -659,7 +665,7 @@ moduleIntegrationTestRunner<IOrderModuleService>({
return_received_quantity: 0,
}),
}),
],
]),
})
)
})
@@ -115,37 +115,37 @@ export class Migration20240219102530 extends Migration {
CREATE INDEX IF NOT EXISTS "IDX_order_display_id" ON "order" (
display_id
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_region_id" ON "order" (
region_id
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_customer_id" ON "order" (
customer_id
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_customer_id" ON "order" (
customer_id
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_currency_code" ON "order" (
currency_code
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_address_id" ON "order" (
shipping_address_id
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_billing_address_id" ON "order" (
billing_address_id
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_deleted_at" ON "order" (
deleted_at
@@ -154,7 +154,7 @@ export class Migration20240219102530 extends Migration {
CREATE INDEX IF NOT EXISTS "IDX_order_is_draft_order" ON "order" (
is_draft_order
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE TABLE IF NOT EXISTS "order_summary" (
@@ -172,7 +172,7 @@ export class Migration20240219102530 extends Migration {
order_id,
version
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE TABLE IF NOT EXISTS "order_change" (
"id" TEXT NOT NULL,
@@ -276,18 +276,18 @@ export class Migration20240219102530 extends Migration {
CREATE INDEX IF NOT EXISTS "IDX_order_item_order_id" ON "order_item" (
order_id
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_item_order_id_version" ON "order_item" (
order_id,
version
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_item_item_id" ON "order_item" (
item_id
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE TABLE IF NOT EXISTS "order_shipping" (
"id" TEXT NOT NULL,
@@ -303,18 +303,18 @@ export class Migration20240219102530 extends Migration {
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_order_id" ON "order_shipping" (
order_id
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_order_id_version" ON "order_shipping" (
order_id,
version
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_item_id" ON "order_shipping" (
shipping_method_id
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE TABLE IF NOT EXISTS "order_line_item" (
"id" TEXT NOT NULL,
@@ -461,17 +461,17 @@ export class Migration20240219102530 extends Migration {
order_id,
version
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_currency_code" ON "order_transaction" (
currency_code
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_reference_id" ON "order_transaction" (
reference_id
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE TABLE IF NOT EXISTS "return_reason"
(
@@ -492,7 +492,7 @@ export class Migration20240219102530 extends Migration {
);
CREATE UNIQUE INDEX IF NOT EXISTS "IDX_return_reason_value" ON "return_reason" USING btree (value ASC NULLS LAST)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
ALTER TABLE if exists "order"
@@ -32,17 +32,17 @@ export class Migration20240604100512 extends Migration {
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_return_id" ON "order_transaction" (
return_id
)
WHERE return_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE return_id IS NOT NULL AND deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_claim_id" ON "order_transaction" (
claim_id
)
WHERE claim_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE claim_id IS NOT NULL AND deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_transaction_exchange_id" ON "order_transaction" (
exchange_id
)
WHERE exchange_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE exchange_id IS NOT NULL AND deleted_at IS NULL;
@@ -58,17 +58,17 @@ export class Migration20240604100512 extends Migration {
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_return_id" ON "order_shipping" (
return_id
)
WHERE return_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE return_id IS NOT NULL AND deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_claim_id" ON "order_shipping" (
claim_id
)
WHERE claim_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE claim_id IS NOT NULL AND deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_exchange_id" ON "order_shipping" (
exchange_id
)
WHERE exchange_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE exchange_id IS NOT NULL AND deleted_at IS NULL;
@@ -85,17 +85,17 @@ export class Migration20240604100512 extends Migration {
CREATE INDEX IF NOT EXISTS "IDX_order_change_return_id" ON "order_change" (
return_id
)
WHERE return_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE return_id IS NOT NULL AND deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_change_claim_id" ON "order_change" (
claim_id
)
WHERE claim_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE claim_id IS NOT NULL AND deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_change_exchange_id" ON "order_change" (
exchange_id
)
WHERE exchange_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE exchange_id IS NOT NULL AND deleted_at IS NULL;
@@ -118,17 +118,17 @@ export class Migration20240604100512 extends Migration {
CREATE INDEX IF NOT EXISTS "IDX_order_change_action_return_id" ON "order_change_action" (
return_id
)
WHERE return_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE return_id IS NOT NULL AND deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_change_action_claim_id" ON "order_change_action" (
claim_id
)
WHERE claim_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE claim_id IS NOT NULL AND deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_change_action_exchange_id" ON "order_change_action" (
exchange_id
)
WHERE exchange_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE exchange_id IS NOT NULL AND deleted_at IS NULL;
@@ -162,22 +162,22 @@ export class Migration20240604100512 extends Migration {
CREATE INDEX IF NOT EXISTS "IDX_return_order_id" ON "return" (
order_id
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_return_claim_id" ON "return" (
claim_id
)
WHERE claim_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE claim_id IS NOT NULL AND deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_return_exchange_id" ON "return" (
exchange_id
)
WHERE exchange_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE exchange_id IS NOT NULL AND deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_return_display_id" ON "return" (
display_id
)
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE TABLE IF NOT EXISTS "return_item" (
@@ -198,16 +198,16 @@ export class Migration20240604100512 extends Migration {
);
CREATE INDEX IF NOT EXISTS "IDX_return_item_deleted_at" ON "return_item" ("deleted_at")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_return_item_return_id" ON "return_item" ("return_id")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_return_item_item_id" ON "return_item" ("item_id")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_return_item_reason_id" ON "return_item" ("reason_id")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
@@ -230,16 +230,16 @@ export class Migration20240604100512 extends Migration {
);
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_display_id" ON "order_exchange" ("display_id")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_deleted_at" ON "order_exchange" ("deleted_at")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_order_id" ON "order_exchange" ("order_id")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_return_id" ON "order_exchange" ("return_id")
WHERE return_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE return_id IS NOT NULL AND deleted_at IS NULL;
CREATE TABLE IF NOT EXISTS "order_exchange_item" (
@@ -257,13 +257,13 @@ export class Migration20240604100512 extends Migration {
);
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_item_deleted_at" ON "order_exchange_item" ("deleted_at")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_item_exchange_id" ON "order_exchange_item" ("exchange_id")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_exchange_item_item_id" ON "order_exchange_item" ("item_id")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
@@ -291,16 +291,16 @@ export class Migration20240604100512 extends Migration {
);
CREATE INDEX IF NOT EXISTS "IDX_order_claim_display_id" ON "order_claim" ("display_id")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_claim_deleted_at" ON "order_claim" ("deleted_at")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_claim_order_id" ON "order_claim" ("order_id")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_claim_return_id" ON "order_claim" ("return_id")
WHERE return_id IS NOT NULL AND deleted_at IS NOT NULL;
WHERE return_id IS NOT NULL AND deleted_at IS NULL;
@@ -328,13 +328,13 @@ export class Migration20240604100512 extends Migration {
);
CREATE INDEX IF NOT EXISTS "IDX_order_claim_item_deleted_at" ON "order_claim_item" ("deleted_at")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_claim_item_claim_id" ON "order_claim_item" ("claim_id")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "IDX_order_claim_item_item_id" ON "order_claim_item" ("item_id")
WHERE deleted_at IS NOT NULL;
WHERE deleted_at IS NULL;