Skip to content

refactor: move stable store SQL to sqlc#67

Merged
steipete merged 8 commits into
mainfrom
refactor/sqlc-store
May 15, 2026
Merged

refactor: move stable store SQL to sqlc#67
steipete merged 8 commits into
mainfrom
refactor/sqlc-store

Conversation

@steipete
Copy link
Copy Markdown
Collaborator

Summary

  • Add sqlc infrastructure for stable Discrawl store SQL: sqlc.yaml, flattened compile-time schema, checked-in generated internal/store/storedb, and a scripts/generate-sqlc.sh helper.
  • Wire Store to generated typed queries and convert stable read/write paths for sync state, status/counts, channels, guilds, members, attachments/media metadata, message upserts/deletes, embedding jobs, and member profile reads.
  • Keep runtime migrations/schema version, FTS rebuild/probes, semantic/vector search, report/share/user SQL, and dynamic filter builders handwritten.
  • Add schema drift coverage plus member enrichment regression coverage caught during review.

Review Notes

  • Runtime migrations remain authoritative; internal/store/sqlc/schema.sql is a sqlc-only flattened mirror of schema version 3.
  • Transactional conversions use q.WithTx(tx).
  • Generated code is checked in so normal builds do not require sqlc.
  • Git snapshot/share paths remain covered by the existing share and CLI tests; this PR does not move dynamic share SQL into sqlc.

Verification

  • ./scripts/generate-sqlc.sh
  • ./scripts/generate-sqlc.sh && git diff --exit-code -- internal/store/storedb internal/store/sqlc
  • GOWORK=off go test ./internal/store
  • GOWORK=off go test ./...
  • DISCRAWL_NO_AUTO_UPDATE=1 GOWORK=off go run ./cmd/discrawl doctor
  • DISCRAWL_NO_AUTO_UPDATE=1 GOWORK=off go run ./cmd/discrawl status --json
  • DISCRAWL_NO_AUTO_UPDATE=1 GOWORK=off go run ./cmd/discrawl search --limit 5 test
  • DISCRAWL_NO_AUTO_UPDATE=1 GOWORK=off go run ./cmd/discrawl sync --source wiretap
  • Codex review: /Users/steipete/Projects/agent-scripts/skills/codex-review/scripts/codex-review --full-access --mode branch --parallel-tests "GOWORK=off go test ./internal/store"

@steipete steipete merged commit bd0b490 into main May 15, 2026
12 checks passed
@steipete steipete deleted the refactor/sqlc-store branch May 15, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant