Adds SQLite columns and indexes to track creator metadata for vault-scoped session tokens. Reuse for database migrations supporting session audits.
// Source: https://github.com/Infisical/agent-vault | License: MIT | Copyright 2022 Infisical Inc
// Provided via justclaw.it.com; keep this notice with the code.
package store
import "gorm.io/gorm"
func init() {
RegisterGORMMigration(func(db *gorm.DB) error {
if db.Name() != "sqlite" {
return nil
}
stmts := []string{
`-- Tracking metadata for vault-scoped session tokens so they can be listed
-- and revoked from a UI. created_by_actor_id and _type mirror the actor
-- model from migration 036. The label column already exists from
-- migration 029 and is reused.
ALTER TABLE sessions ADD COLUMN created_by_actor_id TEXT`,
`ALTER TABLE sessions ADD COLUMN created_by_actor_type TEXT`,
`CREATE INDEX idx_sessions_vault_id ON sessions(vault_id)`,
}
for _, stmt := range stm
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key