|
1
|
import { Migration } from "@medusajs/framework/mikro-orm/migrations" |
|
2
|
|
|
3
|
export class Migration20240716081800 extends Migration { |
|
4
|
async up(): Promise<void> { |
|
5
|
const sql = ` |
|
6
|
DROP INDEX IF EXISTS "IDX_order_line_item_variant_id"; |
|
7
|
DROP INDEX IF EXISTS "IDX_order_line_item_product_id"; |
|
8
|
|
|
9
|
ALTER TABLE "order_line_item" |
|
10
|
ADD COLUMN if NOT exists "deleted_at" timestamptz NULL; |
|
11
|
|
|
12
|
CREATE INDEX IF NOT EXISTS "IDX_order_line_item_variant_id" ON "order_line_item" ( |
|
13
|
variant_id |
|
14
|
) WHERE deleted_at IS NULL; |
|
15
|
|
|
16
|
CREATE INDEX IF NOT EXISTS "IDX_order_line_item_product_id" ON "order_line_item" ( |
|
17
|
product_id |
|
18
|
) WHERE deleted_at IS NULL; |
|
19
|
|
|
20
|
|
|
21
|
|
|
22
|
DROP INDEX IF EXISTS "IDX_order_shipping_method_tax_line_shipping_method_id"; |
|
23
|
|
|
24
|
ALTER TABLE "order_shipping_method_tax_line" |
|
25
|
ADD COLUMN if NOT exists "deleted_at" timestamptz NULL; |
|
26
|
|
|
27
|
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_method_tax_line_shipping_method_id" ON "order_shipping_method_tax_line" ( |
|
28
|
shipping_method_id |
|
29
|
) WHERE deleted_at IS NULL; |
|
30
|
|
|
31
|
|
|
32
|
DROP INDEX IF EXISTS "IDX_order_shipping_method_adjustment_shipping_method_id"; |
|
33
|
|
|
34
|
ALTER TABLE "order_shipping_method_adjustment" |
|
35
|
ADD COLUMN if NOT exists "deleted_at" timestamptz NULL; |
|
36
|
|
|
37
|
CREATE INDEX IF NOT EXISTS "IDX_order_shipping_method_adjustment_shipping_method_id" ON "order_shipping_method_adjustment" ( |
|
38
|
shipping_method_id |
|
39
|
) WHERE deleted_at IS NULL; |
|
40
|
|
|
41
|
|
|
42
|
|
|
43
|
DROP INDEX IF EXISTS "IDX_order_line_item_tax_line_item_id"; |
|
44
|
|
|
45
|
ALTER TABLE "order_line_item_tax_line" |
|
46
|
ADD COLUMN if NOT exists "deleted_at" timestamptz NULL; |
|
47
|
|
|
48
|
CREATE INDEX IF NOT EXISTS "IDX_order_line_item_tax_line_item_id" ON "order_line_item_tax_line" ( |
|
49
|
item_id |
|
50
|
) WHERE deleted_at IS NULL; |
|
51
|
|
|
52
|
DROP INDEX IF EXISTS "IDX_order_line_item_adjustment_item_id"; |
|
53
|
|
|
54
|
ALTER TABLE "order_line_item_adjustment" |
|
55
|
ADD COLUMN if NOT exists "deleted_at" timestamptz NULL; |
|
56
|
|
|
57
|
CREATE INDEX IF NOT EXISTS "IDX_order_line_item_adjustment_item_id" ON "order_line_item_adjustment" ( |
|
58
|
item_id |
|
59
|
) WHERE deleted_at IS NULL; |
|
60
|
` |
|
61
|
|
|
62
|
this.addSql(sql) |
|
63
|
} |
|
64
|
} |