Documentation
¶
Index ¶
- func DropStaleProfileKeyIndex(db *gorm.DB)
- func Migrate(db *gorm.DB)
- func NewGORM(c config.Database) *gorm.DB
- func RepairProviderStorageTree(db *gorm.DB) (int, error)
- type Logger
- func (l Logger) Error(ctx context.Context, msg string, opts ...any)
- func (l Logger) Info(ctx context.Context, msg string, opts ...any)
- func (l Logger) LogMode(level logger.LogLevel) logger.Interface
- func (l Logger) Trace(ctx context.Context, begin time.Time, f func() (string, int64), err error)
- func (l Logger) Warn(ctx context.Context, msg string, opts ...any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DropStaleProfileKeyIndex ¶ added in v0.36.0
DropStaleProfileKeyIndex removes the pre-scoping unique index on agent_profiles(key).
Sub-agent roles became scoped: uniqueness is now (project_id, key), so a project may define a role under a key the global scope already uses. AutoMigrate creates that composite index but leaves the old one in place, and the old one keeps rejecting the second row — surfacing as a constraint violation on save, nowhere near its cause.
Idempotent, and a no-op on databases that never had the index.
func Migrate ¶
Migrate brings the schema up to date. Safe to call from every component that opens a handle to the same database — only the first call does work.
func RepairProviderStorageTree ¶ added in v0.16.10
repairProviderStorageTree rewires every row's parent_id from its rel_path so a row at "/a/b/c" is parented to the row at "/a/b". Heals DBs where an ancestor row was deleted but descendants still reference the dead ID. Idempotent: returns 0 fixed when the tree is already healthy.