chore: refactor
This commit is contained in:
1 parent
f2a4f454fe
commit
00ee67c228
4 files changed
+27
-1
No files matched your search
@@ -717,6 +717,15 @@
|
|||||||
"name": "capture",
|
"name": "capture",
|
||||||
"schema": "public",
|
"schema": "public",
|
||||||
"indexes": [
|
"indexes": [
|
||||||
|
{
|
||||||
|
"columnNames": [
|
||||||
|
"payment_id"
|
||||||
|
],
|
||||||
|
"composite": false,
|
||||||
|
"keyName": "IDX_capture_payment_id",
|
||||||
|
"primary": false,
|
||||||
|
"unique": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"keyName": "capture_pkey",
|
"keyName": "capture_pkey",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
@@ -797,6 +806,15 @@
|
|||||||
"name": "refund",
|
"name": "refund",
|
||||||
"schema": "public",
|
"schema": "public",
|
||||||
"indexes": [
|
"indexes": [
|
||||||
|
{
|
||||||
|
"columnNames": [
|
||||||
|
"payment_id"
|
||||||
|
],
|
||||||
|
"composite": false,
|
||||||
|
"keyName": "IDX_refund_payment_id",
|
||||||
|
"primary": false,
|
||||||
|
"unique": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"keyName": "refund_pkey",
|
"keyName": "refund_pkey",
|
||||||
"columnNames": [
|
"columnNames": [
|
||||||
|
|||||||
+7
-1
@@ -1,6 +1,6 @@
|
|||||||
import { Migration } from "@mikro-orm/migrations"
|
import { Migration } from "@mikro-orm/migrations"
|
||||||
|
|
||||||
export class Migration20240112104455 extends Migration {
|
export class Migration20240112130209 extends Migration {
|
||||||
async up(): Promise<void> {
|
async up(): Promise<void> {
|
||||||
this.addSql(
|
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"));'
|
'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(
|
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"));'
|
'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(
|
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"));'
|
'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(
|
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;'
|
'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
|
amount: number
|
||||||
|
|
||||||
@ManyToOne(() => Payment, {
|
@ManyToOne(() => Payment, {
|
||||||
|
onDelete: "cascade",
|
||||||
index: "IDX_capture_payment_id",
|
index: "IDX_capture_payment_id",
|
||||||
fieldName: "payment_id",
|
fieldName: "payment_id",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export default class Refund {
|
|||||||
amount: number
|
amount: number
|
||||||
|
|
||||||
@ManyToOne(() => Payment, {
|
@ManyToOne(() => Payment, {
|
||||||
|
onDelete: "cascade",
|
||||||
index: "IDX_refund_payment_id",
|
index: "IDX_refund_payment_id",
|
||||||
fieldName: "payment_id",
|
fieldName: "payment_id",
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user