store: create the database directory on Open, not via make run
Summary
Fresh-clone run (make run / go run ./cmd/rax, no pre-existing ./data)
failed on first start:
store: store: migrating ./data/rax.db: executing "CREATE TABLE ...":
unable to open database file (14)
store.Open never created its own database directory — it only worked
because the Makefile's run target papered over the gap with mkdir -p data. Anyone launching the binary any other way (Docker, a built ./rax,
a custom RAX_DB_PATH) hit the same failure on first start.
-
internal/store/store.go:Opennowos.MkdirAlls the target directory beforesql.Open(skipped for the:memory:test path, and for a bare filename with no directory component). -
Makefile: dropped the now-redundantmkdir -p datafromrun. -
README.md: updated the "Running locally" note accordingly.
Test plan
-
gofmt -s -w . && gofmt -l . && go build ./... && go vet ./... && go test ./...— clean -
Built the binary and ran it with RAX_DB_PATH=./freshdata/rax.dbagainst a directory with nofreshdata/present — confirmed it creates the directory andrax.dbon startup with no error