feat: Add the api_tokens collection and its indexes
The unique index on token_hash is what makes authentication an indexed lookup rather than a scan, so this builder is fatal on failure like EnsureAuthIndexes rather than warning like the secrets one. Registered in ScopedCollections so instance purge reaches it.
This commit is contained in:
@@ -109,6 +109,10 @@ func runSchemaSetup() {
|
||||
log.Fatalf("failed to ensure auth indexes: %v", err)
|
||||
}
|
||||
|
||||
if err := services.EnsureAPITokenIndexes(); err != nil {
|
||||
log.Fatalf("api token indexes: %v", err)
|
||||
}
|
||||
|
||||
// 0005 runs AFTER EnsureAuthIndexes: the unique (instance_id, provider_id)
|
||||
// index must exist before anything inserts providers, or a concurrent
|
||||
// re-run could double-insert before the index is there to refuse it.
|
||||
|
||||
Reference in New Issue
Block a user