feat(core-flows,medusa,utils,types): adds delivered_quantity to order (#9130)

what:

- adds delivered_quantity to order


https://github.com/user-attachments/assets/709b1727-08ed-4a88-ae29-38f13540e301
This commit is contained in:
Riqwan Thamir
2024-09-16 11:59:01 +02:00
committed by GitHub
parent 950cf9af79
commit 3e97a64b21
41 changed files with 794 additions and 25 deletions
@@ -869,6 +869,25 @@
"nullable": false,
"mappedType": "json"
},
"delivered_quantity": {
"name": "delivered_quantity",
"type": "numeric",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": false,
"default": "0",
"mappedType": "decimal"
},
"raw_delivered_quantity": {
"name": "raw_delivered_quantity",
"type": "jsonb",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": false,
"mappedType": "json"
},
"shipped_quantity": {
"name": "shipped_quantity",
"type": "numeric",
@@ -0,0 +1,26 @@
import { Migration } from "@mikro-orm/migrations"
export class Migration20240913092514 extends Migration {
async up(): Promise<void> {
this.addSql(
'alter table if exists "order_item" add column if not exists "delivered_quantity" numeric not null default 0, add column if not exists "raw_delivered_quantity" jsonb;'
)
this.addSql(
`UPDATE "order_item" SET raw_delivered_quantity = '{"value": "0", "precision": 20}'::jsonb;`
)
this.addSql(
'ALTER TABLE IF EXISTS "order_item" ALTER COLUMN "raw_delivered_quantity" SET NOT NULL;'
)
}
async down(): Promise<void> {
this.addSql(
'alter table if exists "order_item" drop column if exists "delivered_quantity";'
)
this.addSql(
'alter table if exists "order_item" drop column if exists "raw_delivered_quantity";'
)
}
}