fix(order): run migration before setting not null (#8831)
This commit is contained in:
@@ -3,7 +3,15 @@ import { Migration } from "@mikro-orm/migrations"
|
||||
export class Migration20240827133639 extends Migration {
|
||||
async up(): Promise<void> {
|
||||
this.addSql(
|
||||
'alter table if exists "return_item" add column if not exists "damaged_quantity" numeric not null default 0, add column if not exists "raw_damaged_quantity" jsonb not null;'
|
||||
'alter table if exists "return_item" add column if not exists "damaged_quantity" numeric not null default 0, add column if not exists "raw_damaged_quantity" jsonb;'
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
`UPDATE "return_item" SET raw_damaged_quantity = '{"value": "0", "precision": 20}'::jsonb;`
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
'ALTER TABLE IF EXISTS "return_item" ALTER COLUMN "raw_damaged_quantity" SET NOT NULL;'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user