@nymbalhq/platform 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-74KODSYJ.js +2564 -0
- package/dist/chunk-74KODSYJ.js.map +1 -0
- package/dist/chunk-PW6ILJF7.js +740 -0
- package/dist/chunk-PW6ILJF7.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/db/schema/index.d.ts +10125 -0
- package/dist/db/schema/index.js +10 -0
- package/dist/db/schema/index.js.map +1 -0
- package/dist/index.d.ts +1373 -0
- package/dist/index.js +6462 -0
- package/dist/index.js.map +1 -0
- package/dist/register-IVFYBJSX.js +8 -0
- package/dist/register-IVFYBJSX.js.map +1 -0
- package/drizzle.config.postgres.ts +10 -0
- package/drizzle.config.sqlite.ts +10 -0
- package/migrations/postgres/0000_tearful_longshot.sql +166 -0
- package/migrations/postgres/0001_neat_zeigeist.sql +1 -0
- package/migrations/postgres/0002_sloppy_mad_thinker.sql +20 -0
- package/migrations/postgres/0003_violet_violations.sql +15 -0
- package/migrations/postgres/0004_white_reavers.sql +15 -0
- package/migrations/postgres/0005_natural_nico_minoru.sql +12 -0
- package/migrations/postgres/0006_minor_dragon_man.sql +28 -0
- package/migrations/postgres/meta/0000_snapshot.json +1172 -0
- package/migrations/postgres/meta/0001_snapshot.json +1187 -0
- package/migrations/postgres/meta/0002_snapshot.json +1325 -0
- package/migrations/postgres/meta/0003_snapshot.json +1432 -0
- package/migrations/postgres/meta/0004_snapshot.json +1439 -0
- package/migrations/postgres/meta/0005_snapshot.json +1461 -0
- package/migrations/postgres/meta/0006_snapshot.json +1598 -0
- package/migrations/postgres/meta/_journal.json +55 -0
- package/migrations/sqlite/0000_glorious_vision.sql +166 -0
- package/migrations/sqlite/0001_tricky_glorian.sql +1 -0
- package/migrations/sqlite/0002_puzzling_epoch.sql +19 -0
- package/migrations/sqlite/0003_fantastic_captain_stacy.sql +15 -0
- package/migrations/sqlite/0004_remarkable_shriek.sql +12 -0
- package/migrations/sqlite/0005_conscious_speedball.sql +13 -0
- package/migrations/sqlite/0006_flat_psylocke.sql +28 -0
- package/migrations/sqlite/meta/0000_snapshot.json +1093 -0
- package/migrations/sqlite/meta/0001_snapshot.json +1100 -0
- package/migrations/sqlite/meta/0002_snapshot.json +1222 -0
- package/migrations/sqlite/meta/0003_snapshot.json +1320 -0
- package/migrations/sqlite/meta/0004_snapshot.json +1328 -0
- package/migrations/sqlite/meta/0005_snapshot.json +1343 -0
- package/migrations/sqlite/meta/0006_snapshot.json +1470 -0
- package/migrations/sqlite/meta/_journal.json +55 -0
- package/package.json +85 -3
- package/README.md +0 -3
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "7",
|
|
3
|
+
"dialect": "postgresql",
|
|
4
|
+
"entries": [
|
|
5
|
+
{
|
|
6
|
+
"idx": 0,
|
|
7
|
+
"version": "7",
|
|
8
|
+
"when": 1776875073819,
|
|
9
|
+
"tag": "0000_tearful_longshot",
|
|
10
|
+
"breakpoints": true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"idx": 1,
|
|
14
|
+
"version": "7",
|
|
15
|
+
"when": 1792286470820,
|
|
16
|
+
"tag": "0001_neat_zeigeist",
|
|
17
|
+
"breakpoints": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"idx": 2,
|
|
21
|
+
"version": "7",
|
|
22
|
+
"when": 1792302105204,
|
|
23
|
+
"tag": "0002_sloppy_mad_thinker",
|
|
24
|
+
"breakpoints": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"idx": 3,
|
|
28
|
+
"version": "7",
|
|
29
|
+
"when": 1792310135268,
|
|
30
|
+
"tag": "0003_violet_violations",
|
|
31
|
+
"breakpoints": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"idx": 4,
|
|
35
|
+
"version": "7",
|
|
36
|
+
"when": 1792325873393,
|
|
37
|
+
"tag": "0004_white_reavers",
|
|
38
|
+
"breakpoints": true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"idx": 5,
|
|
42
|
+
"version": "7",
|
|
43
|
+
"when": 1792361576997,
|
|
44
|
+
"tag": "0005_natural_nico_minoru",
|
|
45
|
+
"breakpoints": true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"idx": 6,
|
|
49
|
+
"version": "7",
|
|
50
|
+
"when": 1792397472998,
|
|
51
|
+
"tag": "0006_minor_dragon_man",
|
|
52
|
+
"breakpoints": true
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
CREATE TABLE `categories` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`parent_id` text,
|
|
4
|
+
`slug` text NOT NULL,
|
|
5
|
+
`name` text NOT NULL,
|
|
6
|
+
`description` text DEFAULT '' NOT NULL,
|
|
7
|
+
`position` integer DEFAULT 0 NOT NULL,
|
|
8
|
+
`created_at` text NOT NULL
|
|
9
|
+
);
|
|
10
|
+
--> statement-breakpoint
|
|
11
|
+
CREATE UNIQUE INDEX `categories_slug_unique` ON `categories` (`slug`);--> statement-breakpoint
|
|
12
|
+
CREATE INDEX `categories_parent_idx` ON `categories` (`parent_id`);--> statement-breakpoint
|
|
13
|
+
CREATE TABLE `customers` (
|
|
14
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
15
|
+
`email` text NOT NULL,
|
|
16
|
+
`password_hash` text NOT NULL,
|
|
17
|
+
`first_name` text DEFAULT '' NOT NULL,
|
|
18
|
+
`last_name` text DEFAULT '' NOT NULL,
|
|
19
|
+
`phone` text DEFAULT '' NOT NULL,
|
|
20
|
+
`addresses` text DEFAULT '[]' NOT NULL,
|
|
21
|
+
`order_count` integer DEFAULT 0 NOT NULL,
|
|
22
|
+
`total_spent_minor` integer DEFAULT 0 NOT NULL,
|
|
23
|
+
`metadata` text DEFAULT '{}' NOT NULL,
|
|
24
|
+
`requires_password_reset` integer DEFAULT false NOT NULL,
|
|
25
|
+
`created_at` text NOT NULL,
|
|
26
|
+
`updated_at` text NOT NULL
|
|
27
|
+
);
|
|
28
|
+
--> statement-breakpoint
|
|
29
|
+
CREATE UNIQUE INDEX `customers_email_unique` ON `customers` (`email`);--> statement-breakpoint
|
|
30
|
+
CREATE TABLE `inventory_reservations` (
|
|
31
|
+
`reservation_id` text PRIMARY KEY NOT NULL,
|
|
32
|
+
`variant_id` text NOT NULL,
|
|
33
|
+
`qty` integer NOT NULL,
|
|
34
|
+
`order_ref` text,
|
|
35
|
+
`expires_at` text NOT NULL,
|
|
36
|
+
`created_at` text NOT NULL
|
|
37
|
+
);
|
|
38
|
+
--> statement-breakpoint
|
|
39
|
+
CREATE INDEX `inv_reservations_variant_idx` ON `inventory_reservations` (`variant_id`);--> statement-breakpoint
|
|
40
|
+
CREATE INDEX `inv_reservations_expires_idx` ON `inventory_reservations` (`expires_at`);--> statement-breakpoint
|
|
41
|
+
CREATE TABLE `order_history` (
|
|
42
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
43
|
+
`order_id` text NOT NULL,
|
|
44
|
+
`from_status` text,
|
|
45
|
+
`to_status` text NOT NULL,
|
|
46
|
+
`actor` text NOT NULL,
|
|
47
|
+
`note` text DEFAULT '' NOT NULL,
|
|
48
|
+
`timestamp` text NOT NULL
|
|
49
|
+
);
|
|
50
|
+
--> statement-breakpoint
|
|
51
|
+
CREATE INDEX `order_history_order_idx` ON `order_history` (`order_id`);--> statement-breakpoint
|
|
52
|
+
CREATE TABLE `order_sequences` (
|
|
53
|
+
`id` integer PRIMARY KEY NOT NULL,
|
|
54
|
+
`next_value` integer NOT NULL
|
|
55
|
+
);
|
|
56
|
+
--> statement-breakpoint
|
|
57
|
+
CREATE TABLE `orders` (
|
|
58
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
59
|
+
`order_number` text NOT NULL,
|
|
60
|
+
`sequence` integer NOT NULL,
|
|
61
|
+
`customer_id` text,
|
|
62
|
+
`status` text DEFAULT 'pending' NOT NULL,
|
|
63
|
+
`email` text NOT NULL,
|
|
64
|
+
`billing_address` text NOT NULL,
|
|
65
|
+
`shipping_address` text NOT NULL,
|
|
66
|
+
`line_items` text NOT NULL,
|
|
67
|
+
`subtotal_minor` integer NOT NULL,
|
|
68
|
+
`tax_total_minor` integer DEFAULT 0 NOT NULL,
|
|
69
|
+
`shipping_total_minor` integer DEFAULT 0 NOT NULL,
|
|
70
|
+
`discount_total_minor` integer DEFAULT 0 NOT NULL,
|
|
71
|
+
`total_minor` integer NOT NULL,
|
|
72
|
+
`currency` text NOT NULL,
|
|
73
|
+
`notes` text DEFAULT '' NOT NULL,
|
|
74
|
+
`metadata` text DEFAULT '{}' NOT NULL,
|
|
75
|
+
`payment_intent_id` text,
|
|
76
|
+
`created_at` text NOT NULL,
|
|
77
|
+
`updated_at` text NOT NULL
|
|
78
|
+
);
|
|
79
|
+
--> statement-breakpoint
|
|
80
|
+
CREATE UNIQUE INDEX `orders_number_unique` ON `orders` (`order_number`);--> statement-breakpoint
|
|
81
|
+
CREATE UNIQUE INDEX `orders_sequence_unique` ON `orders` (`sequence`);--> statement-breakpoint
|
|
82
|
+
CREATE INDEX `orders_customer_idx` ON `orders` (`customer_id`);--> statement-breakpoint
|
|
83
|
+
CREATE INDEX `orders_status_idx` ON `orders` (`status`);--> statement-breakpoint
|
|
84
|
+
CREATE TABLE `product_categories` (
|
|
85
|
+
`product_id` text NOT NULL,
|
|
86
|
+
`category_id` text NOT NULL,
|
|
87
|
+
PRIMARY KEY(`product_id`, `category_id`)
|
|
88
|
+
);
|
|
89
|
+
--> statement-breakpoint
|
|
90
|
+
CREATE INDEX `product_categories_category_idx` ON `product_categories` (`category_id`);--> statement-breakpoint
|
|
91
|
+
CREATE TABLE `products` (
|
|
92
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
93
|
+
`slug` text NOT NULL,
|
|
94
|
+
`name` text NOT NULL,
|
|
95
|
+
`description` text DEFAULT '' NOT NULL,
|
|
96
|
+
`short_description` text DEFAULT '' NOT NULL,
|
|
97
|
+
`status` text DEFAULT 'draft' NOT NULL,
|
|
98
|
+
`type` text DEFAULT 'simple' NOT NULL,
|
|
99
|
+
`seo_title` text DEFAULT '' NOT NULL,
|
|
100
|
+
`seo_description` text DEFAULT '' NOT NULL,
|
|
101
|
+
`media` text DEFAULT '[]' NOT NULL,
|
|
102
|
+
`metadata` text DEFAULT '{}' NOT NULL,
|
|
103
|
+
`created_at` text NOT NULL,
|
|
104
|
+
`updated_at` text NOT NULL
|
|
105
|
+
);
|
|
106
|
+
--> statement-breakpoint
|
|
107
|
+
CREATE UNIQUE INDEX `products_slug_unique` ON `products` (`slug`);--> statement-breakpoint
|
|
108
|
+
CREATE INDEX `products_status_idx` ON `products` (`status`);--> statement-breakpoint
|
|
109
|
+
CREATE TABLE `refresh_tokens` (
|
|
110
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
111
|
+
`customer_id` text NOT NULL,
|
|
112
|
+
`token_hash` text NOT NULL,
|
|
113
|
+
`revoked_at` text,
|
|
114
|
+
`replaced_by_jti` text,
|
|
115
|
+
`expires_at` text NOT NULL,
|
|
116
|
+
`created_at` text NOT NULL
|
|
117
|
+
);
|
|
118
|
+
--> statement-breakpoint
|
|
119
|
+
CREATE INDEX `refresh_tokens_customer_idx` ON `refresh_tokens` (`customer_id`);--> statement-breakpoint
|
|
120
|
+
CREATE TABLE `reviews` (
|
|
121
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
122
|
+
`product_id` text NOT NULL,
|
|
123
|
+
`customer_id` text,
|
|
124
|
+
`order_id` text,
|
|
125
|
+
`rating` integer NOT NULL,
|
|
126
|
+
`title` text DEFAULT '' NOT NULL,
|
|
127
|
+
`body` text DEFAULT '' NOT NULL,
|
|
128
|
+
`moderation_status` text DEFAULT 'pending' NOT NULL,
|
|
129
|
+
`submitted_at` text NOT NULL,
|
|
130
|
+
`moderated_at` text,
|
|
131
|
+
`moderated_by` text
|
|
132
|
+
);
|
|
133
|
+
--> statement-breakpoint
|
|
134
|
+
CREATE INDEX `reviews_product_idx` ON `reviews` (`product_id`);--> statement-breakpoint
|
|
135
|
+
CREATE INDEX `reviews_status_idx` ON `reviews` (`moderation_status`);--> statement-breakpoint
|
|
136
|
+
CREATE TABLE `stock_adjustments` (
|
|
137
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
138
|
+
`variant_id` text NOT NULL,
|
|
139
|
+
`adjustment` integer NOT NULL,
|
|
140
|
+
`reason` text NOT NULL,
|
|
141
|
+
`actor` text NOT NULL,
|
|
142
|
+
`previous_qty` integer NOT NULL,
|
|
143
|
+
`new_qty` integer NOT NULL,
|
|
144
|
+
`timestamp` text NOT NULL
|
|
145
|
+
);
|
|
146
|
+
--> statement-breakpoint
|
|
147
|
+
CREATE INDEX `stock_adjustments_variant_idx` ON `stock_adjustments` (`variant_id`);--> statement-breakpoint
|
|
148
|
+
CREATE TABLE `variants` (
|
|
149
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
150
|
+
`product_id` text NOT NULL,
|
|
151
|
+
`sku` text NOT NULL,
|
|
152
|
+
`name` text DEFAULT '' NOT NULL,
|
|
153
|
+
`price_minor` integer NOT NULL,
|
|
154
|
+
`compare_at_price_minor` integer,
|
|
155
|
+
`weight_grams` integer,
|
|
156
|
+
`dimensions` text,
|
|
157
|
+
`stock` integer DEFAULT 0 NOT NULL,
|
|
158
|
+
`low_stock_threshold` integer DEFAULT 0 NOT NULL,
|
|
159
|
+
`options` text DEFAULT '[]' NOT NULL,
|
|
160
|
+
`status` text DEFAULT 'active' NOT NULL,
|
|
161
|
+
`created_at` text NOT NULL,
|
|
162
|
+
`updated_at` text NOT NULL
|
|
163
|
+
);
|
|
164
|
+
--> statement-breakpoint
|
|
165
|
+
CREATE UNIQUE INDEX `variants_sku_unique` ON `variants` (`sku`);--> statement-breakpoint
|
|
166
|
+
CREATE INDEX `variants_product_idx` ON `variants` (`product_id`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CREATE INDEX `orders_payment_intent_idx` ON `orders` (`payment_intent_id`);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
CREATE TABLE `events` (
|
|
2
|
+
`seq` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
3
|
+
`id` text NOT NULL,
|
|
4
|
+
`type` text NOT NULL,
|
|
5
|
+
`envelope` text NOT NULL,
|
|
6
|
+
`created_at` text NOT NULL,
|
|
7
|
+
`delivered_at` text,
|
|
8
|
+
`attempts` integer DEFAULT 0 NOT NULL,
|
|
9
|
+
`dead_at` text
|
|
10
|
+
);
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
CREATE UNIQUE INDEX `events_id_unique` ON `events` (`id`);--> statement-breakpoint
|
|
13
|
+
CREATE INDEX `events_undelivered_idx` ON `events` (`delivered_at`,`seq`);--> statement-breakpoint
|
|
14
|
+
CREATE TABLE `processed_events` (
|
|
15
|
+
`handler_name` text NOT NULL,
|
|
16
|
+
`event_id` text NOT NULL,
|
|
17
|
+
`processed_at` text NOT NULL,
|
|
18
|
+
PRIMARY KEY(`handler_name`, `event_id`)
|
|
19
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
CREATE TABLE `carts` (
|
|
2
|
+
`token` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`customer_id` text,
|
|
4
|
+
`currency` text NOT NULL,
|
|
5
|
+
`items` text DEFAULT '[]' NOT NULL,
|
|
6
|
+
`line_count` integer DEFAULT 0 NOT NULL,
|
|
7
|
+
`subtotal_minor` integer DEFAULT 0 NOT NULL,
|
|
8
|
+
`expires_at` text NOT NULL,
|
|
9
|
+
`created_at` text NOT NULL,
|
|
10
|
+
`updated_at` text NOT NULL,
|
|
11
|
+
`abandoned_notified_at` text
|
|
12
|
+
);
|
|
13
|
+
--> statement-breakpoint
|
|
14
|
+
CREATE INDEX `carts_expires_idx` ON `carts` (`expires_at`);--> statement-breakpoint
|
|
15
|
+
CREATE INDEX `carts_updated_idx` ON `carts` (`updated_at`);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
ALTER TABLE `customers` ADD `roles` text DEFAULT '["customer"]' NOT NULL;--> statement-breakpoint
|
|
2
|
+
-- Roles move out of free-form metadata: known roles survive, a row left with none keeps the column's ['customer'].
|
|
3
|
+
UPDATE `customers` SET `roles` = (
|
|
4
|
+
SELECT json_group_array(DISTINCT `r`.`value`) FROM json_each(`customers`.`metadata`, '$.roles') AS `r`
|
|
5
|
+
WHERE `r`.`type` = 'text' AND `r`.`value` IN ('admin', 'customer', 'guest')
|
|
6
|
+
)
|
|
7
|
+
WHERE json_valid(`metadata`) AND json_type(`metadata`, '$.roles') = 'array' AND EXISTS (
|
|
8
|
+
SELECT 1 FROM json_each(`customers`.`metadata`, '$.roles') AS `r`
|
|
9
|
+
WHERE `r`.`type` = 'text' AND `r`.`value` IN ('admin', 'customer', 'guest')
|
|
10
|
+
);--> statement-breakpoint
|
|
11
|
+
UPDATE `customers` SET `metadata` = json_remove(`metadata`, '$.roles')
|
|
12
|
+
WHERE json_valid(`metadata`) AND json_type(`metadata`, '$.roles') IS NOT NULL;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
ALTER TABLE `orders` ADD `cart_token` text;--> statement-breakpoint
|
|
2
|
+
-- The cart moves out of free-form metadata. Of several pending orders on one cart (made before this guard existed) only
|
|
3
|
+
-- the newest takes the token, so the index below can be built; the older ones stay as they are, without one.
|
|
4
|
+
UPDATE `orders` SET `cart_token` = json_extract(`metadata`, '$.cartToken')
|
|
5
|
+
WHERE json_valid(`metadata`) AND json_type(`metadata`, '$.cartToken') = 'text' AND (
|
|
6
|
+
`status` <> 'pending' OR NOT EXISTS (
|
|
7
|
+
SELECT 1 FROM `orders` AS `newer`
|
|
8
|
+
WHERE `newer`.`status` = 'pending' AND `newer`.`sequence` > `orders`.`sequence`
|
|
9
|
+
AND json_valid(`newer`.`metadata`)
|
|
10
|
+
AND json_extract(`newer`.`metadata`, '$.cartToken') = json_extract(`orders`.`metadata`, '$.cartToken')
|
|
11
|
+
)
|
|
12
|
+
);--> statement-breakpoint
|
|
13
|
+
CREATE UNIQUE INDEX `orders_pending_cart_unique` ON `orders` (`cart_token`) WHERE status = 'pending';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
CREATE TABLE `order_refunds` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`order_id` text NOT NULL,
|
|
4
|
+
`amount_minor` integer NOT NULL,
|
|
5
|
+
`currency` text NOT NULL,
|
|
6
|
+
`provider_refund_id` text,
|
|
7
|
+
`status` text DEFAULT 'pending' NOT NULL,
|
|
8
|
+
`reason` text,
|
|
9
|
+
`actor` text NOT NULL,
|
|
10
|
+
`created_at` text NOT NULL,
|
|
11
|
+
`request_id` text
|
|
12
|
+
);
|
|
13
|
+
--> statement-breakpoint
|
|
14
|
+
CREATE INDEX `order_refunds_order_idx` ON `order_refunds` (`order_id`);--> statement-breakpoint
|
|
15
|
+
CREATE UNIQUE INDEX `order_refunds_order_request_idx` ON `order_refunds` (`order_id`,`request_id`);--> statement-breakpoint
|
|
16
|
+
ALTER TABLE `orders` ADD `captured_minor` integer DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
17
|
+
ALTER TABLE `orders` ADD `captured_at` text;--> statement-breakpoint
|
|
18
|
+
ALTER TABLE `orders` ADD `refunded_minor` integer DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
19
|
+
ALTER TABLE `orders` ADD `capture_method` text;--> statement-breakpoint
|
|
20
|
+
-- Orders taken before captures were recorded: one confirmed or later (and not cancelled) was paid in full when it last
|
|
21
|
+
-- changed; with an intent the provider took it, without one it came from an import. A partially_refunded order keeps
|
|
22
|
+
-- refunded_minor 0: what it refunded was never stored, and there is no production data from before this migration.
|
|
23
|
+
UPDATE `orders`
|
|
24
|
+
SET `captured_minor` = `total_minor`,
|
|
25
|
+
`captured_at` = `updated_at`,
|
|
26
|
+
`capture_method` = CASE WHEN `payment_intent_id` IS NULL THEN 'import' ELSE 'provider' END
|
|
27
|
+
WHERE `status` IN ('confirmed', 'processing', 'shipped', 'delivered', 'refunded', 'partially_refunded');--> statement-breakpoint
|
|
28
|
+
UPDATE `orders` SET `refunded_minor` = `captured_minor` WHERE `status` = 'refunded';
|