mirror of
https://github.com/Dvorinka/Primora.git
synced 2026-10-28 15:51:23 +00:00
feat: phase 2 databases via DBX (v0.3.0)
- dbx-mcp persistent stdio subprocess in Go backend (internal/dbx), lazy start + single retry, tool failures surface as 502 - core.db_connections registry: per-project connections, credentials server-side only, managed entries protected (409) - platform-postgres + platform-dragonfly auto-register per project - REST proxy: list/create/delete/test, databases, tables, describe, schema context, SQL query, redis command - Databases page: connection list, schema/table browser, column inspector, SQL editor with result grid + row detail, redis console - backend image moved to debian-slim for glibc; pinned dbx release with SHA256 verification Authored By: TDvorak <[email protected]>
This commit is contained in:
1 parent
420502eec1
commit
627bd89d5e
71 files changed
+3685
-49
No files matched your search
@@ -0,0 +1,18 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE core.db_connections (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
project_id UUID NOT NULL REFERENCES core.projects(id) ON DELETE CASCADE,
|
||||
name TEXT NOT NULL,
|
||||
db_type TEXT NOT NULL,
|
||||
config JSONB NOT NULL DEFAULT '{}'::jsonb,
|
||||
is_managed BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
created_by_user_id UUID REFERENCES core.users(id) ON DELETE SET NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
UNIQUE (project_id, name)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_db_connections_project_id ON core.db_connections(project_id);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE IF EXISTS core.db_connections;
|
||||
@@ -0,0 +1,30 @@
|
||||
-- name: ListDBConnections :many
|
||||
SELECT * FROM core.db_connections
|
||||
WHERE project_id = $1
|
||||
ORDER BY is_managed DESC, name ASC;
|
||||
|
||||
-- name: GetDBConnectionByID :one
|
||||
SELECT * FROM core.db_connections
|
||||
WHERE id = $1;
|
||||
|
||||
-- name: GetDBConnectionByName :one
|
||||
SELECT * FROM core.db_connections
|
||||
WHERE project_id = $1
|
||||
AND name = $2;
|
||||
|
||||
-- name: CreateDBConnection :one
|
||||
INSERT INTO core.db_connections (
|
||||
project_id,
|
||||
name,
|
||||
db_type,
|
||||
config,
|
||||
is_managed,
|
||||
created_by_user_id
|
||||
) VALUES ($1, $2, $3, $4, $5, $6)
|
||||
RETURNING *;
|
||||
|
||||
-- name: DeleteDBConnection :one
|
||||
DELETE FROM core.db_connections
|
||||
WHERE id = $1
|
||||
AND project_id = $2
|
||||
RETURNING *;
|
||||
Reference in new issue
Block a user