Runtime metadata table (_pgconsole)#2
Merged
Conversation
Covers pgschema CLI integration, git-based schema source config, MigrationService RPC design, and frontend Schema Diff View. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Define PlanMigration, ApplyMigration (streaming), and GetSchemaSourceStatus RPCs for the schema migration feature. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PlanMigration syncs git, runs pgschema plan, stores result. ApplyMigration streams progress and executes pgschema apply. GetSchemaSourceStatus returns schema_source config for a connection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Shows schema diffs from git source, supports DDL preview, and gated apply with confirmation dialog (requires ddl permission). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Show migration panel when no object is selected and the connection has a schema_source configured. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ype handling and utility functions
…in MigrationPanel
…ies for target architectures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runtime metadata table (
_pgconsole)Summary
Replace the static
schema_sourceconfig inpgconsole.tomlwith a runtime_pgconsolemetadata table stored directly in the target PostgreSQL database. This enables runtime CRUD of migration settings without config changes or restarts.Motivation
The
[connections.schema_source]block inpgconsole.tomlwas static — changing it required editing the config file and restarting pgconsole. Since pgconsole already connects to the target database, storing this metadata in the DB itself is simpler and enables runtime management.Changes
New: MetadataService (general-purpose KV store)
proto/metadata.proto— NewMetadataServicewith 5 RPCs:InitMetadataTable,GetMetadata,SetMetadata,DeleteMetadata,ListMetadataserver/services/metadata-service.ts— Service implementation. Creates a_pgconsoletable (key TEXT PK, value JSONB, updated_at TIMESTAMPTZ). Permission gating:adminfor init,readfor get/list,writefor set/deleteserver/connect.ts— Registered MetadataService route with logging interceptorserver/index.ts— Added/metadata.v1.to SPA fallback skip listChanged: Migration service reads from DB
server/services/migration-service.ts—planMigrationandgetSchemaSourceStatusnow readschema_sourcefrom the_pgconsoletable instead of config. AddedgetSchemaSource()helper that queries the DBserver/lib/config.ts— RemovedSchemaSourceConfiginterface andschema_sourcefromConnectionConfig. Removed config parsing logic forschema_sourceserver/lib/pgschema.ts— AddedrepoDirparameter torunPgSchemaPlanandrunPgSchemaApply. Writes.pgschemaignoreto exclude_pgconsoletable from schema plansFrontend: Init + configure flow in Migration panel
src/lib/connect-client.ts— AddedmetadataClientsrc/hooks/useMigration.ts— AddeduseMetadataTableStatus,useInitMetadataTable,useSetSchemaSourcehookssrc/components/sql-editor/schema/MigrationPanel.tsx— Replaced static "not configured" message with interactiveSchemaSourceSetupcomponent:_pgconsoletable existsSetMetadataand reloads into the migration plan flowvite.config.ts— Added/metadata.v1.MetadataServiceproxy entryCleanup
docker-compose.yml— Removedschema_sourceblock (contained leaked credentials)pgconsole.example.toml— Removedschema_sourceexampletests/config-schema-source.test.ts— Removed (no longer relevant)Dockerfile— Fixed pgschema binary extraction to handle versioned filenames; removed hardcodedTARGETARCH=amd64default so BuildKit auto-detects platformSchema
Table is created explicitly by the user via
InitMetadataTableRPC (opt-in, never auto-created).