
migrasure
MigraSure is designed to help developers and database administrators ensure that their database migrations are successful and that the data integrity is maintained across different database systems.
Repository Info
About This Server
MigraSure is designed to help developers and database administrators ensure that their database migrations are successful and that the data integrity is maintained across different database systems.
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Database Migration Validator (MigraSure)
MigraSure is designed to help developers and database administrators ensure that their database migrations are successful and that the data integrity is maintained across different database systems.
A system that uses AI agents to validate database migrations from SQL Server to PostgreSQL by comparing schemas, row counts, and data consistency.
System Overview
This project contains a Docker-based environment that:
- Runs a SQL Server source database with sample data
- Runs a PostgreSQL target database that mirrors the schema
- Connects both databases to DBHub MCP servers (database connectors)
- Provides a Flask web interface for running AI-powered migration validation
The system uses OpenAI or Google Gemini models through the agents framework to intelligently compare databases, detect inconsistencies, and produce a detailed validation report.
Prerequisites
- Docker and Docker Compose
- OpenAI API key (for OpenAI models)
- Google Gemini API key (optional, for Gemini models)
Setup Instructions
-
Clone this repository
-
Set environment variables
Create a
.envfile in the project root with:OPENAI_API_KEY=your_openai_api_key GEMINI_API_KEY=your_gemini_api_key -
Build and start the containers
docker-compose up -dThis will:
- Start SQL Server with sample data
- Start PostgreSQL with mirrored schema
- Start DBHub connectors for both databases
- Build and start the validation agent
-
Access the web interface
Open your browser and navigate to:
http://localhost:5005
Usage
-
On the web interface, select an AI model from the dropdown:
- OpenAI models (GPT-4.1-mini, GPT-4.1-nano)
- Google Gemini models (via LiteLLM)
-
Click "Run Validation" to start the validation process
-
The system will:
- Connect to both databases
- Compare table schemas
- Compare row counts
- Check data consistency
- Generate an HTML report with findings
-
Review the validation results showing tables that matched or had discrepancies
-
Click the "View Execution Trace" link to see detailed agent execution steps
Troubleshooting
Dependency Conflicts
If you encounter dependency conflicts between openai-agents and litellm, update your requirements.txt:
openai-agents==0.0.14
openai>=1.76.0,<1.78.0
Flask~=2.3.3
litellm>=1.70.0
Database Connection Issues
Ensure Docker containers are running properly:
docker ps
Check logs for specific services:
docker logs sqlserver
docker logs postgres
docker logs dbhub_source
docker logs dbhub_target
docker logs agent
Components
- SQL Server: Source database with sample ecommerce data
- PostgreSQL: Target database with migrated schema
- DBHub MCP Servers: Database connectors with REST API interfaces
- Agent Service: Flask app with OpenAI/Gemini integration for validation
Architecture
!Architecture Diagram
The agent accesses both databases through their respective DBHub MCP servers, which provide a consistent interface regardless of the underlying database technology.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Quick Start
Clone the repository
git clone https://github.com/dorangao/migrasureInstall dependencies
cd migrasure
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.