MCPcopy Create free account
hub / github.com/compozy/agh / recoverSQLiteDatabase

Function recoverSQLiteDatabase

internal/store/sqlite.go:198–209  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

196}
197
198func recoverSQLiteDatabase(path string) (string, error) {
199 corruptPath := fmt.Sprintf("%s.corrupt.%s", path, time.Now().UTC().Format("20060102T150405.000000000Z0700"))
200 if err := os.Rename(path, corruptPath); err != nil {
201 return "", err
202 }
203 for _, suffix := range []string{sqliteWalValue, sqliteShmValue} {
204 if err := renameSQLiteCompanion(path+suffix, corruptPath+suffix); err != nil {
205 return "", err
206 }
207 }
208 return corruptPath, nil
209}
210
211func renameSQLiteCompanion(source string, target string) error {
212 if err := os.Rename(source, target); err != nil {

Calls 2

renameSQLiteCompanionFunction · 0.85
NowMethod · 0.45

Tested by 1