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:
juanzgc
2025-11-17 13:50:57 -05:00
committed by GitHub
parent 1ea932a56f
commit ef15868ca8
4 changed files with 28 additions and 0 deletions

View File

@@ -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",

View File

@@ -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";`);
}
}

View File

@@ -28,6 +28,7 @@ const Promotion = model
pivotTable: "promotion_promotion_rule",
mappedBy: "promotions",
}),
metadata: model.json().nullable(),
})
.cascades({
delete: ["application_method"],