From d14c8a497fde2a5e19c3c56a28ef7e4a93262bce Mon Sep 17 00:00:00 2001 From: Crypto Minion <154598612+jrwbabylonlab@users.noreply.github.com> Date: Fri, 3 Jan 2025 18:45:03 +1100 Subject: [PATCH] feat: setup db index for delegation and timelock collection (#105) --- internal/db/model/setup.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/db/model/setup.go b/internal/db/model/setup.go index 0fe1eaf..7ba86b2 100644 --- a/internal/db/model/setup.go +++ b/internal/db/model/setup.go @@ -28,10 +28,14 @@ type index struct { var collections = map[string][]index{ FinalityProviderDetailsCollection: {{Indexes: map[string]int{}}}, - BTCDelegationDetailsCollection: {{Indexes: map[string]int{}}}, - TimeLockCollection: {{Indexes: map[string]int{}}}, - GlobalParamsCollection: {{Indexes: map[string]int{}}}, - LastProcessedHeightCollection: {{Indexes: map[string]int{}}}, + BTCDelegationDetailsCollection: { + {Indexes: map[string]int{"staker_btc_pk_hex": 1, "start_height": -1, "_id": 1}, Unique: false}, + }, + TimeLockCollection: { + {Indexes: map[string]int{"expire_height": 1}, Unique: false}, + }, + GlobalParamsCollection: {{Indexes: map[string]int{}}}, + LastProcessedHeightCollection: {{Indexes: map[string]int{}}}, } func Setup(ctx context.Context, cfg *config.Config) error {