{"id":24664469,"url":"https://github.com/codexparas/db-migrator","last_synced_at":"2026-04-08T18:02:05.726Z","repository":{"id":274211384,"uuid":"921763590","full_name":"CodexParas/db-migrator","owner":"CodexParas","description":"DB Migrator is a Spring Boot-based tool for seamless data migration between MySQL, PostgreSQL, and Oracle databases. Using Spring Batch, it supports efficient batch processing and provides REST APIs for migration and data insertion.","archived":false,"fork":false,"pushed_at":"2025-02-20T09:10:26.000Z","size":51,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-06T11:39:51.907Z","etag":null,"topics":["batch-processing","data-migration","mysql","openapi","oracle","postgresql","rest-api","spring-batch","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodexParas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-24T15:15:07.000Z","updated_at":"2025-06-03T14:03:06.000Z","dependencies_parsed_at":"2025-02-20T10:23:03.335Z","dependency_job_id":"8a06d433-1731-4922-8b5f-08f12cdca3a7","html_url":"https://github.com/CodexParas/db-migrator","commit_stats":null,"previous_names":["codexparas/db-migrator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CodexParas/db-migrator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodexParas%2Fdb-migrator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodexParas%2Fdb-migrator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodexParas%2Fdb-migrator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodexParas%2Fdb-migrator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodexParas","download_url":"https://codeload.github.com/CodexParas/db-migrator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodexParas%2Fdb-migrator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31567227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["batch-processing","data-migration","mysql","openapi","oracle","postgresql","rest-api","spring-batch","spring-boot"],"created_at":"2025-01-26T06:13:12.857Z","updated_at":"2026-04-08T18:02:05.688Z","avatar_url":"https://github.com/CodexParas.png","language":"Java","readme":"# DB Migrator\n\nA Spring Boot-based tool for **migrating data between relational databases** (MySQL, PostgreSQL, Oracle) and generating\nmock datasets. Built with Spring Batch for robust, transactional workflows.\n\n---\n\n## 📌 Table of Contents\n\n- [Features](#-features)\n- [Tech Stack](#-tech-stack)\n- [Getting Started](#-getting-started)\n    - [Prerequisites](#prerequisites)\n    - [Local Setup](#local-setup)\n    - [Docker Setup](#docker-setup-optional)\n- [API Documentation](#-api-documentation)\n- [Workflow Details](#-workflow-details)\n    - [Data Migration](#data-migration-flow)\n    - [Data Insertion](#data-insertion-flow)\n- [Configuration](#-configuration)\n- [Roadmap](#-roadmap)\n- [Contributing](#-contributing)\n- [License](#-license)\n\n---\n\n## 🚀 Features\n\n- **Cross-Database Migration**: Move data between MySQL, PostgreSQL, and Oracle.\n- **Mock Data Generation**: Insert customizable test datasets into any supported database.\n- **Batch Processing**: Chunk-based (100 records/transaction) processing for large datasets.\n- **Multi-DB Configuration**: Isolated connection pools and JPA configurations for each database.\n- **REST API Integration**: Trigger operations via Swagger-documented endpoints.\n\n---\n\n## 🛠️ Tech Stack\n\n- **Core**: Spring Boot 3.4.2, Java 21\n- **Persistence**: Spring Data JPA, Hibernate\n- **Batch Processing**: Spring Batch\n- **Databases**: MySQL, PostgreSQL, Oracle\n- **Utilities**: Lombok, MapStruct, SpringDoc (OpenAPI 3)\n- **Build**: Maven\n\n---\n\n## 🏁 Getting Started\n\n### Prerequisites\n\n- Java 21, Maven, Docker (optional).\n- Running instances of MySQL, PostgreSQL, and/or Oracle.\n\n### Local Setup\n\n1. **Clone the repository**:\n   ```bash  \n   git clone https://github.com/CodexParas/db-migrator.git  \n   cd db-migrator  \n   ```  \n\n2. **Install dependencies**:\n   ```bash  \n   mvn clean install  \n   ```  \n\n3. **Configure databases**:  \n   Update `src/main/resources/application.yaml` with your database credentials.\n\n4. **Run the application**:\n   ```bash  \n   mvn spring-boot:run  \n   ```  \n\n### Docker Setup (Optional)\n\nStart databases using Docker:\n\n```bash  \ndocker-compose up -d  # Launches MySQL, PostgreSQL, and Oracle containers  \n```  \n\n---\n\n## 📚 API Documentation\n\n**Interactive Swagger UI**:  \nAccess at `http://localhost:9121/api/swagger-ui.html` after starting the app.\n\n### Key Endpoints\n\n#### **1. Migrate Data**\n\n```http  \nPOST /api/migrate/toMySql  \nContent-Type: application/json  \n\n{  \n  \"source\": \"POSTGRES\"  # [MYSQL, POSTGRES, ORACLE]  \n}  \n```  \n\n**Response**:\n\n```json  \n{\n  \"status\": \"SUCCESS\",\n  \"message\": \"Data migrated\",\n  \"data\": null\n}  \n```  \n\n#### **2. Insert Mock Data**\n\n```http  \nPOST /api/data/insert/mysql  \nContent-Type: application/json  \n\n{  \n  \"count\": 1000  # Number of records to generate  \n}  \n```  \n\n**Response**:\n\n```json  \n{\n  \"status\": \"SUCCESS\",\n  \"message\": \"Data inserted\",\n  \"data\": null\n}  \n```  \n\n---\n\n## 🔄 Workflow Details\n\n### Data Migration Flow\n\n```mermaid  \nsequenceDiagram  \n  User-\u003e\u003eAPI: POST /migrate/toMySql {source: \"POSTGRES\"}  \n  API-\u003e\u003eMigrationService: Trigger Job  \n  MigrationService-\u003e\u003eSpring Batch: Run migrateToMysqlJob  \n  Spring Batch-\u003e\u003eSource DB: Read data via DbDataSupplier  \n  Spring Batch-\u003e\u003eTarget DB: Write data via JPA Repository  \n  Spring Batch--\u003e\u003eUser: Return success  \n```  \n\n**Steps**:\n\n1. **Reader**: Fetches data from the source DB (e.g., PostgreSQL).\n2. **Processor**: Pass-through (no transformation; extend for custom logic).\n3. **Writer**: Saves data to the target DB (e.g., MySQL) in chunks (100 records/transaction).\n\n---\n\n### Data Insertion Flow\n\n```mermaid  \nsequenceDiagram  \n  User-\u003e\u003eAPI: POST /data/insert/mysql {count: 500}  \n  API-\u003e\u003eDataService: Trigger Job  \n  DataService-\u003e\u003eSpring Batch: Run MySqlDataInsertJob  \n  Spring Batch-\u003e\u003eMockDataGenerator: Generate 500 records  \n  Spring Batch-\u003e\u003eMySQL: Save data via JPA Repository  \n  Spring Batch--\u003e\u003eUser: Return success  \n```  \n\n**Steps**:\n\n1. **Reader**: Generates mock data (e.g., names, emails) using `MockDataGenerator`.\n2. **Writer**: Inserts records into the target database.\n\n---\n\n## ⚙️ Configuration\n\n### Key `application.yaml` Settings\n\n```yaml  \nserver:\n  port: 9121\n  servlet:\n    context-path: /api\n\nspring:\n  datasource:\n    mysql:\n      jdbcUrl: jdbc:mysql://localhost:3306/db_migrator\n      username: root\n      password: root\n  batch:\n    job.enabled: false       # Disable auto-startup of jobs  \n    jdbc.initialize-schema: ALWAYS  # Create batch tables on startup  \n```  \n\n### Tuning Batch Jobs\n\n- **Chunk Size**: Adjust in job configurations (e.g., `MigrateToMysql.java`):\n  ```java  \n  .\u003cMySqlClientEntity, MySqlClientEntity\u003echunk(200, mySqlTransactionManager)  \n  ```  \n\n---\n\n## 🗺️ Roadmap\n\n- **MongoDB Support**: Migrate to/from MongoDB collections.\n- **Rollback Mechanism**: API-driven undo for migrations.\n- **Enhanced Monitoring**: Integrate Spring Actuator for job metrics.\n- **Error Handling**: Retry policies, dead-letter queues.\n- **Authentication**: Basic API key/JWT support.\n\n---\n\n## 🤝 Contributing\n\nContributions welcome!\n\n1. Fork the repository.\n2. Create a feature branch (`git checkout -b feature/your-feature`).\n3. Add tests for new functionality.\n4. Submit a pull request with a detailed description.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodexparas%2Fdb-migrator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodexparas%2Fdb-migrator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodexparas%2Fdb-migrator/lists"}