From 4a99098066f4175303dd7343152157179c8583f2 Mon Sep 17 00:00:00 2001 From: wjrjerome Date: Fri, 3 Jan 2025 18:38:19 +1100 Subject: [PATCH] feat: setup db index for delegation and timelock collection --- 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 {