Skip to content

feat: support multiple databases#44

Open
omercnet wants to merge 31 commits into
mainfrom
feat/multi-database-support
Open

feat: support multiple databases#44
omercnet wants to merge 31 commits into
mainfrom
feat/multi-database-support

Conversation

@omercnet

@omercnet omercnet commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add multi-database config via exactly one source family: URL lists, numbered env vars, or mounted JSON files
  • add DB pool registry plus ?db=<id> routing for DB-bound API endpoints
  • add database switcher with bookmarkable URL state in the no-build Preact UI
  • document env/config-file formats plus Kubernetes ConfigMap and Compose volume examples
  • add docs screenshot for the new database selector
  • reduce test complexity by splitting database URL/SQL/helper tests into focused files

Validation

  • GOTOOLCHAIN=go1.26.4 PATH="$(go env GOPATH)/bin:$PATH" make ci
  • GitHub checks: CodeQL, go, web, image build, Wiz, Cubic all passing
  • Review threads: 0 unresolved

Notes

  • Single-database installs remain compatible with DATABASE_URL.
  • Multi-database config source families are mutually exclusive to avoid hidden precedence and duplicate-ID complexity.
  • Multi-database API selection uses URL query parameter db; saved-query CRUD remains database-independent.

Comment thread web/url-state.js Fixed
Comment thread web/db-selector.test.js Fixed
Comment thread web/url-state.test.js Fixed

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

21 issues found and verified against the latest diff

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="internal/server/http_helpers.go">

<violation number="1" location="internal/server/http_helpers.go:81">
P3: writeJSON silently discards json.Encoder.Encode error. If encoding fails mid-stream (e.g., broken connection or unsupported value type), the response is already committed with the status code and there's no diagnostic log.</violation>
</file>

<file name="internal/server/middleware.go">

<violation number="1" location="internal/server/middleware.go:38">
P3: CSP style-src 'unsafe-inline' weakens the policy by permitting arbitrary inline styles (enables CSS-based data exfiltration attacks). Consider nonce- or hash-based style-src if feasible.</violation>
</file>

Note: This PR contains a large number of files. cubic only reviews up to 40 files per PR, so some files may not have been reviewed. cubic prioritizes the most important files to review.
On a pro plan you can use ultrareview for larger PRs.

Re-trigger cubic

Comment thread internal/server/saved_query_handlers_test.go Outdated
Comment thread web/sql-tab.js
Comment thread internal/config/databases.go Outdated
Comment thread web/url-state.js Outdated
Comment thread internal/server/catalog_handlers.go Outdated
Comment thread web/structure-tab.js
Comment thread internal/server/http_helpers.go
Comment thread internal/server/middleware.go
Comment thread web/sql-tab.js Outdated
Comment thread web/url-state.test.js Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 issues found across 22 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread .github/workflows/ci.yml Outdated
Comment thread web/api.js Outdated
Comment thread internal/server/catalog_handlers.go
Comment thread web/index.html
@omercnet omercnet force-pushed the feat/multi-database-support branch from 25ad62e to 5c5a684 Compare June 26, 2026 04:30
Comment thread web/db-sql.test.js Fixed
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.

2 participants