feat: enhance migration handling and update documentation for bridge architecture#75
Merged
Conversation
…ge and FEATURES.md with AI Providers feature
…igration lock functionality
…nhance migration handling with schema snapshots
… and schema drift handling components
…nc functionality and update related components
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands RelWave’s migration/import workflow and bridge architecture by adding import analysis + migration sync UI, improving schema snapshot/baseline handling across connectors, and updating AI prompting/provider limits plus documentation.
Changes:
- Added import analysis + UI flows to prompt users to apply pending migrations or apply a schema snapshot baseline, plus “migration sync” actions in the Git panel.
- Improved bridge-side schema snapshot/migration support (new schema file v2 shape, migration lock file, connector baseline generation from real snapshots).
- Increased AI provider output limits and refactored schema-analysis prompt formatting; updated project documentation/READMEs.
Reviewed changes
Copilot reviewed 57 out of 59 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/services/bridge/project.ts | Adds frontend bridge service methods for import/migration workflows (incl. SQL generation call). |
| src/pages/DatabaseDetails.tsx | Integrates migration panel navigation and migration sync dialog into DB detail page. |
| src/lib/utils.ts | Adds shared timestamp + relative time formatting helpers. |
| src/features/schema-explorer/components/SchemaExplorerHeader.tsx | Uses selected/first schema as default instead of hardcoded public. |
| src/features/project/types.ts | Adds import analysis + drift typing for new migration sync features. |
| src/features/project/hooks/useProjectSync.ts | Adds import analysis fetch + prevents auto schema overwrite when drift detected. |
| src/features/project/hooks/useImportAnalysis.ts | New hook to fetch import analysis for overview cards. |
| src/features/project/components/SchemaDriftSheet.tsx | New sheet UI to display drift state and refresh schema cache. |
| src/features/project/components/MigrationSyncDialog.tsx | New dialog prompting users to apply migrations or apply a schema snapshot baseline (+ SQL preview). |
| src/features/home/utils.ts | Removes home-scoped relative-time util (moved to shared utils). |
| src/features/home/components/WelcomeView.tsx | Switches to shared formatRelativeTime helper. |
| src/features/home/components/MigrationStatusCard.tsx | New card showing migration/drift status using import analysis. |
| src/features/home/components/index.ts | Stops re-exporting removed home utils. |
| src/features/home/components/DatabaseOverviewPanel.tsx | Adds migration status card when a project exists. |
| src/features/home/components/DatabaseDetail.tsx | Passes projectId into overview panel. |
| src/features/home/components/ConnectionDetails.tsx | Uses shared timestamp formatting for createdAt. |
| src/features/git/components/GitStatusPanel.tsx | Adds migration sync/push actions wired to new project RPC methods. |
| src/features/database/components/MigrationsPanel.tsx | Improves pending count + uses shared timestamp formatting. |
| src/components/ui/SQLPreviewSheet.tsx | New SQL preview sheet for baseline SQL preview. |
| src/components/ui/skeleton.tsx | New Skeleton component for loading states. |
| src/components/ui/sheet.tsx | New Sheet primitive wrapper for drift UI. |
| src/components/layout/VerticalIconBar.tsx | Adds a “Migrations” panel entry to DB navigation. |
| pnpm-lock.yaml | Lockfile updates (platform metadata changes). |
| FEATURES.md | Adds “AI Features and Providers” documentation section. |
| CONTRIBUTING.md | Adds bridge package build instructions + test docker compose step. |
| bridge/src/utils/README.md | Documents bridge utils folder structure/conventions. |
| bridge/src/utils/migrationFileReader.ts | Accepts 13- or 14-digit migration versions in filenames. |
| bridge/src/utils/config.ts | Removes legacy getMigrationsDir (moved to project store resolution). |
| bridge/src/utils/baselineMigration.ts | Generates baseline SQL from real schema snapshots (+ quoting). |
| bridge/src/types/README.md | Documents bridge shared types folder. |
| bridge/src/types/common.ts | Extends column detail shape with unique/serial/check/comment fields. |
| bridge/src/services/README.md | Documents bridge services folder and responsibilities. |
| bridge/src/services/queryExecutor.ts | Maps new column metadata fields into canonical schema shape. |
| bridge/src/services/projectStore.ts | Introduces schema file v2, schema migration, and migration dir resolution/migration. |
| bridge/src/services/migrationLock.ts | Adds migration lock read/write/verify utilities. |
| bridge/src/services/gitService.ts | Adds migration sync orchestration helpers (stage/commit/push). |
| bridge/src/services/aiHistoryStore.ts | Reuses sqlite native binding resolver via direct import. |
| bridge/src/queries/README.md | Documents centralized SQL query module structure. |
| bridge/src/queries/postgres/tables.ts | Adds unique/serial/comment/check constraint fields to column batch query. |
| bridge/src/queries/mysql/columns.ts | Adds unique/serial/comment fields (and placeholder check) to column batch query. |
| bridge/src/jsonRpcHandler.ts | Registers new RPC methods and updates ProjectHandlers constructor args. |
| bridge/src/handlers/README.md | Documents handler architecture and how to add RPC methods. |
| bridge/src/handlers/projectHandlers.ts | Adds import analysis, schema cache refresh, migration sync/push/verify RPC endpoints. |
| bridge/src/handlers/migrationHandlers.ts | Adds apply-all/apply-snapshot endpoints and updates migration dir resolution + git/lock hooks. |
| bridge/src/connectors/sqlite.ts | Uses projectStore migrations dir + passes snapshot into baseline generation; exports native binding resolver. |
| bridge/src/connectors/README.md | Documents connector structure and conventions. |
| bridge/src/connectors/postgres.ts | Uses projectStore migrations dir + passes snapshot into baseline generation; enriches column mapping. |
| bridge/src/connectors/mysql.ts | Uses projectStore migrations dir + passes snapshot into baseline generation; enriches column mapping. |
| bridge/src/connectors/mariadb.ts | Uses projectStore migrations dir + passes snapshot into baseline generation; enriches column mapping. |
| bridge/src/ai/providers/openai.provider.ts | Raises max output tokens. |
| bridge/src/ai/providers/ollama.provider.ts | Raises max output tokens via num_predict. |
| bridge/src/ai/providers/mistral.provider.ts | Raises max output tokens. |
| bridge/src/ai/providers/groq.provider.ts | Raises max output tokens. |
| bridge/src/ai/providers/gemini.provider.ts | Raises max output tokens via generation config. |
| bridge/src/ai/providers/anthropic.provider.ts | Raises max output tokens. |
| bridge/src/ai/prompts/schema-analysis.ts | Refactors schema analysis prompt into denser/token-efficient format. |
| bridge/pnpm-lock.yaml | Updates bridge lockfile for uuid bump. |
| bridge/package.json | Updates uuid dependency version. |
| bridge/tests/projectStore.test.ts | Updates schema snapshot test fixtures for schema v2 fields. |
Files not reviewed (2)
- bridge/pnpm-lock.yaml: Generated file
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request introduces several improvements and updates across the AI features, database connector architecture, and dependency management for the bridge package. The most significant changes include a new AI features section in the documentation, enhanced schema analysis prompt formatting, increased AI model output limits, improved baseline migration handling for MySQL/MariaDB connectors, and an upgrade of the
uuidpackage.AI Features and Prompt Improvements
FEATURES.md, documenting supported LLM providers, AI capabilities, and privacy options.schema-analysis.tsfor denser, more token-efficient output, improving downstream AI analysis quality.Database Connector Architecture and Migration Handling
README.mdinsrc/connectorsdescribing the connector layout, extension points, and best practices for bridge database integration.projectStoreInstancefor migration directory resolution and schema snapshot retrieval.Dependency and Build Updates
uuidto version 14 and added@types/uuidto dependencies for improved type safety and compatibility. Updatedpnpm-lock.yamlaccordingly. [1] [2] [3] [4] [5] [6] [7] [8]CONTRIBUTING.mdwith instructions for building the bridge package on Windows and Linux.