fix(order): run migration before setting not null (#8831)
This commit is contained in:
1 parent
69c5d122b1
commit
2ee374fafc
1 file changed
+9
-1
@@ -3,7 +3,15 @@ import { Migration } from "@mikro-orm/migrations"
|
|||||||
export class Migration20240827133639 extends Migration {
|
export class Migration20240827133639 extends Migration {
|
||||||
async up(): Promise<void> {
|
async up(): Promise<void> {
|
||||||
this.addSql(
|
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