fix(docs/storage): resolve FLAW-02, remove unused docDir and update documentation for pure database architecture
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 39s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 39s
This commit is contained in:
1 parent
3480859d8a
commit
0bdeb5f320
7 files changed
+42
-52
No files matched your search
@@ -21,19 +21,15 @@ import (
|
||||
|
||||
type Store struct {
|
||||
db *sql.DB
|
||||
docDir string
|
||||
initMu sync.Mutex
|
||||
}
|
||||
|
||||
func NewStore(dbPath string) (*Store, error) {
|
||||
var docDir string
|
||||
if dbPath != ":memory:" && !strings.HasPrefix(dbPath, "file:") {
|
||||
dir := filepath.Dir(dbPath)
|
||||
if err := os.MkdirAll(dir, 0755); err != nil {
|
||||
return nil, fmt.Errorf("failed to create data directory %s: %w", dir, err)
|
||||
}
|
||||
docDir = filepath.Join(dir, "workspace")
|
||||
_ = os.MkdirAll(docDir, 0755)
|
||||
}
|
||||
|
||||
dsn := dbPath
|
||||
@@ -49,7 +45,7 @@ func NewStore(dbPath string) (*Store, error) {
|
||||
db.SetMaxOpenConns(8)
|
||||
db.SetMaxIdleConns(4)
|
||||
|
||||
store := &Store{db: db, docDir: docDir}
|
||||
store := &Store{db: db}
|
||||
if err := store.migrate(); err != nil {
|
||||
return nil, fmt.Errorf("failed to run migrations: %w", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user