fix: add missing indexes
This commit is contained in:
@@ -425,6 +425,15 @@
|
||||
"name": "payment-session",
|
||||
"schema": "public",
|
||||
"indexes": [
|
||||
{
|
||||
"columnNames": [
|
||||
"payment_collection_id"
|
||||
],
|
||||
"composite": false,
|
||||
"keyName": "IDX_payment_session_payment_collection_id",
|
||||
"primary": false,
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"keyName": "payment-session_pkey",
|
||||
"columnNames": [
|
||||
@@ -617,6 +626,15 @@
|
||||
"primary": false,
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"columnNames": [
|
||||
"payment_collection_id"
|
||||
],
|
||||
"composite": false,
|
||||
"keyName": "IDX_payment_payment_collection_id",
|
||||
"primary": false,
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"columnNames": [
|
||||
"session_id"
|
||||
|
||||
+7
-1
@@ -1,6 +1,6 @@
|
||||
import { Migration } from "@mikro-orm/migrations"
|
||||
|
||||
export class Migration20240112130209 extends Migration {
|
||||
export class Migration20240112131027 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"));'
|
||||
@@ -24,6 +24,9 @@ export class Migration20240112130209 extends Migration {
|
||||
this.addSql(
|
||||
'create table if not exists "payment-session" ("id" text not null, "currency_code" text null, "amount" numeric not null, "provider_id" text not null, "data" jsonb null, "status" text check ("status" in (\'authorized\', \'pending\', \'requires_more\', \'error\', \'canceled\')) not null, "is_selected" boolean null, "authorised_at" timestamptz null, "payment_collection_id" text not null, constraint "payment-session_pkey" primary key ("id"));'
|
||||
)
|
||||
this.addSql(
|
||||
'create index "IDX_payment_session_payment_collection_id" on "payment-session" ("payment_collection_id");'
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
'create table if not exists "payment" ("id" text not null, "amount" numeric not null, "authorized_amount" numeric null, "currency_code" text not null, "provider_id" text not null, "cart_id" text null, "order_id" text null, "customer_id" text null, "data" jsonb null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "captured_at" timestamptz null, "canceled_at" timestamptz null, "payment_collection_id" text not null, "session_id" text not null, constraint "payment_pkey" primary key ("id"));'
|
||||
@@ -31,6 +34,9 @@ export class Migration20240112130209 extends Migration {
|
||||
this.addSql(
|
||||
'create index "IDX_payment_deleted_at" on "payment" ("deleted_at");'
|
||||
)
|
||||
this.addSql(
|
||||
'create index "IDX_payment_payment_collection_id" on "payment" ("payment_collection_id");'
|
||||
)
|
||||
this.addSql(
|
||||
'alter table "payment" add constraint "payment_session_id_unique" unique ("session_id");'
|
||||
)
|
||||
@@ -87,6 +87,7 @@ export default class PaymentSession {
|
||||
authorised_at: Date | null
|
||||
|
||||
@ManyToOne({
|
||||
index: "IDX_payment_session_payment_collection_id",
|
||||
fieldName: "payment_collection_id",
|
||||
})
|
||||
payment_collection!: PaymentCollection
|
||||
|
||||
@@ -113,6 +113,7 @@ export default class Payment {
|
||||
captures = new Collection<Capture>(this)
|
||||
|
||||
@ManyToOne({
|
||||
index: "IDX_payment_payment_collection_id",
|
||||
fieldName: "payment_collection_id",
|
||||
})
|
||||
payment_collection!: PaymentCollection
|
||||
|
||||
Reference in New Issue
Block a user