Add UnderlyingDB() method for extension database access

Implements database platform layer for extensions like VC to create
their own tables in the same SQLite database.

Changes:
- Add UnderlyingDB() *sql.DB to Storage interface
- Implement in SQLiteStorage to expose underlying connection
- Add comprehensive test suite (5 tests, -race clean)
- Tests cover: basic access, extension tables, concurrency,
  lifecycle safety, and transaction behavior

This allows VC to host its executor_instances and other tables
alongside beads core tables with proper FK enforcement.

Related issues: bd-57, bd-64, bd-65, bd-66

Amp-Thread-ID: https://ampcode.com/threads/T-a6715beb-fe92-4dee-b931-3c9327124875
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-22 17:19:57 -07:00
parent a689c66f77
commit 6829372c39
6 changed files with 312 additions and 12 deletions

View File

@@ -1899,3 +1899,9 @@ func (s *SQLiteStorage) Close() error {
func (s *SQLiteStorage) Path() string {
return s.dbPath
}
// UnderlyingDB returns the underlying *sql.DB connection
// This allows extensions (like VC) to create their own tables in the same database
func (s *SQLiteStorage) UnderlyingDB() *sql.DB {
return s.db
}