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:
@@ -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";'
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user