feat(promotion): Add metadata column to promotion (#13999)
* feat(promotion): Add metadata column to promotion Add metadata column to the promotion model. Closes CORE-1276 * Add changeset --------- Co-authored-by: Frane Polić <16856471+fPolic@users.noreply.github.com>
This commit is contained in:
@@ -530,6 +530,15 @@
|
||||
"nullable": true,
|
||||
"mappedType": "text"
|
||||
},
|
||||
"metadata": {
|
||||
"name": "metadata",
|
||||
"type": "jsonb",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": true,
|
||||
"mappedType": "json"
|
||||
},
|
||||
"created_at": {
|
||||
"name": "created_at",
|
||||
"type": "timestamptz",
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Migration } from '@mikro-orm/migrations';
|
||||
|
||||
export class Migration20251107050148 extends Migration {
|
||||
|
||||
override async up(): Promise<void> {
|
||||
this.addSql(`alter table if exists "promotion" add column if not exists "metadata" jsonb null;`);
|
||||
}
|
||||
|
||||
override async down(): Promise<void> {
|
||||
this.addSql(`alter table if exists "promotion" drop column if exists "metadata";`);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,6 +28,7 @@ const Promotion = model
|
||||
pivotTable: "promotion_promotion_rule",
|
||||
mappedBy: "promotions",
|
||||
}),
|
||||
metadata: model.json().nullable(),
|
||||
})
|
||||
.cascades({
|
||||
delete: ["application_method"],
|
||||
|
||||
Reference in New Issue
Block a user