chore: refactor
This commit is contained in:
@@ -717,6 +717,15 @@
|
||||
"name": "capture",
|
||||
"schema": "public",
|
||||
"indexes": [
|
||||
{
|
||||
"columnNames": [
|
||||
"payment_id"
|
||||
],
|
||||
"composite": false,
|
||||
"keyName": "IDX_capture_payment_id",
|
||||
"primary": false,
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"keyName": "capture_pkey",
|
||||
"columnNames": [
|
||||
@@ -797,6 +806,15 @@
|
||||
"name": "refund",
|
||||
"schema": "public",
|
||||
"indexes": [
|
||||
{
|
||||
"columnNames": [
|
||||
"payment_id"
|
||||
],
|
||||
"composite": false,
|
||||
"keyName": "IDX_refund_payment_id",
|
||||
"primary": false,
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"keyName": "refund_pkey",
|
||||
"columnNames": [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Migration } from "@mikro-orm/migrations"
|
||||
|
||||
export class Migration20240112104455 extends Migration {
|
||||
export class Migration20240112130209 extends Migration {
|
||||
async up(): Promise<void> {
|
||||
this.addSql(
|
||||
'create table if not exists "payment-collection" ("id" text not null, "currency_code" text null, "amount" numeric not null, "authorized_amount" numeric null, "refunded_amount" numeric null, "region_id" text null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "completed_at" timestamptz null, "status" text check ("status" in (\'not_paid\', \'awaiting\', \'authorized\', \'partially_authorized\', \'canceled\')) not null default \'not_paid\', constraint "payment-collection_pkey" primary key ("id"));'
|
||||
@@ -38,10 +38,16 @@ export class Migration20240112104455 extends Migration {
|
||||
this.addSql(
|
||||
'create table if not exists "capture" ("id" text not null, "amount" numeric not null, "payment_id" text not null, "created_at" timestamptz not null default now(), "created_by" text null, constraint "capture_pkey" primary key ("id"));'
|
||||
)
|
||||
this.addSql(
|
||||
'create index "IDX_capture_payment_id" on "capture" ("payment_id");'
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
'create table if not exists "refund" ("id" text not null, "amount" numeric not null, "payment_id" text not null, "created_at" timestamptz not null default now(), "created_by" text null, constraint "refund_pkey" primary key ("id"));'
|
||||
)
|
||||
this.addSql(
|
||||
'create index "IDX_refund_payment_id" on "refund" ("payment_id");'
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
'alter table "payment-collection_payment_providers" add constraint "payment-collection_payment_providers_payment_coll_6b015_foreign" foreign key ("payment_collection_id") references "payment-collection" ("id") on update cascade on delete cascade;'
|
||||
@@ -27,6 +27,7 @@ export default class Capture {
|
||||
amount: number
|
||||
|
||||
@ManyToOne(() => Payment, {
|
||||
onDelete: "cascade",
|
||||
index: "IDX_capture_payment_id",
|
||||
fieldName: "payment_id",
|
||||
})
|
||||
|
||||
@@ -27,6 +27,7 @@ export default class Refund {
|
||||
amount: number
|
||||
|
||||
@ManyToOne(() => Payment, {
|
||||
onDelete: "cascade",
|
||||
index: "IDX_refund_payment_id",
|
||||
fieldName: "payment_id",
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user