feat(core-flows): support ad hoc returns (#13598)
* feat(core-flows): support ad hoc returns * fix: missing transform * handle edge case * refactor * replace gte for gt * cleanup * weird bug fix * add test * Create quick-nails-kick.md * stop sending empty strings * add code to refund reason * fix build * fix tests * handle code in dashboard * fix tests * more tests failing * add reference and reference id to credit lieng * rework create refund form
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { Migration } from "@mikro-orm/migrations"
|
||||
|
||||
export class Migration20250929124701 extends Migration {
|
||||
override async up(): Promise<void> {
|
||||
// Step 1: Add the column as nullable
|
||||
this.addSql(
|
||||
`alter table "refund_reason" add column "code" text;`
|
||||
)
|
||||
|
||||
// Step 2: Populate the code column from label (convert to snake_case)
|
||||
this.addSql(`
|
||||
update "refund_reason"
|
||||
set "code" = lower(replace("label", ' ', '_'));
|
||||
`)
|
||||
|
||||
// Step 3: Set the column to not nullable
|
||||
this.addSql(`alter table "refund_reason" alter column "code" set not null;`)
|
||||
}
|
||||
|
||||
override async down(): Promise<void> {
|
||||
// Remove the code column
|
||||
this.addSql(`alter table "refund_reason" drop column "code";`)
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import Refund from "./refund"
|
||||
const RefundReason = model.define("RefundReason", {
|
||||
id: model.id({ prefix: "refr" }).primaryKey(),
|
||||
label: model.text().searchable(),
|
||||
code: model.text().searchable(),
|
||||
description: model.text().searchable().nullable(),
|
||||
metadata: model.json().nullable(),
|
||||
refunds: model.hasMany(() => Refund, {
|
||||
|
||||
Reference in New Issue
Block a user