mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* Allow payment initiation list endpoint to query by adjustment status * Add additional indexes to payment adjustments to prevent sequential scans * Add migration script for new indexes on payment initiation * Remove unneeded relation in orm model for payment initiations
24 lines
572 B
Go
24 lines
572 B
Go
package migrations
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/uptrace/bun"
|
|
)
|
|
|
|
func AddPaymentInitiationAdjustmentsIndexes(ctx context.Context, db bun.IDB) error {
|
|
_, err := db.ExecContext(ctx, `
|
|
CREATE INDEX CONCURRENTLY IF NOT EXISTS payment_initiation_adjustments_pi_id ON payment_initiation_adjustments (payment_initiation_id);
|
|
`)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = db.ExecContext(ctx, `
|
|
CREATE INDEX CONCURRENTLY IF NOT EXISTS payment_initiation_adjustments_sort_id ON payment_initiation_adjustments (sort_id);
|
|
`)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|