MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / migrate

Function migrate

internal/appstate/store.go:65–77  ·  view source on GitHub ↗

migrate applies idempotent, additive schema changes to databases created by older versions. ADD COLUMN on an existing column returns a "duplicate column" error which we treat as already-applied.

(ctx context.Context, db *sql.DB)

Source from the content-addressed store, hash-verified

63// older versions. ADD COLUMN on an existing column returns a "duplicate column"
64// error which we treat as already-applied.
65func migrate(ctx context.Context, db *sql.DB) error {
66 for _, stmt := range []string{
67 `ALTER TABLE providers ADD COLUMN api_key TEXT NOT NULL DEFAULT ''`,
68 } {
69 if _, err := db.ExecContext(ctx, stmt); err != nil {
70 if strings.Contains(err.Error(), "duplicate column name") {
71 continue
72 }
73 return err
74 }
75 }
76 return nil
77}
78
79// ImportProvidersJSON is a no-op. Providers were historically migrated from a
80// legacy providers.json file into the SQLite store. That migration is complete

Callers 1

InitMethod · 0.85

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected