@@ -115,18 +115,30 @@ func (s *Store) createIndexes(ctx context.Context) error {
115115 return fmt .Errorf ("failed to create challenge indexes: %w" , err )
116116 }
117117
118+ // Drop old incorrect issuers collection indexes
119+ _ , _ = s .issuers .collection .Indexes ().DropOne (ctx , "identifier_1" )
120+
118121 // Issuers collection indexes
119122 _ , err = s .issuers .collection .Indexes ().CreateOne (ctx , mongo.IndexModel {
120- Keys : bson.D {{Key : "identifier" , Value : 1 }},
123+ Keys : bson.D {
124+ {Key : "credential_issuer_identifier" , Value : 1 },
125+ {Key : "tenant_id" , Value : 1 },
126+ },
121127 Options : options .Index ().SetUnique (true ),
122128 })
123129 if err != nil {
124130 return fmt .Errorf ("failed to create issuer indexes: %w" , err )
125131 }
126132
133+ // Drop old incorrect verifiers collection indexes
134+ _ , _ = s .verifiers .collection .Indexes ().DropOne (ctx , "did_1" )
135+
127136 // Verifiers collection indexes
128137 _ , err = s .verifiers .collection .Indexes ().CreateOne (ctx , mongo.IndexModel {
129- Keys : bson.D {{Key : "did" , Value : 1 }},
138+ Keys : bson.D {
139+ {Key : "url" , Value : 1 },
140+ {Key : "tenant_id" , Value : 1 },
141+ },
130142 Options : options .Index ().SetUnique (true ),
131143 })
132144 if err != nil {
0 commit comments