This repository was archived by the owner on Dec 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
68 additions
and
56 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,119 +1,131 @@ | ||
# PostgreSQL to MariaDB Migration Tool | ||
|
||
A robust PHP-based tool designed to automate the migration of databases from PostgreSQL to MariaDB, ensuring data integrity, preservation of relationships, and structure. | ||
A PHP-based tool to facilitate database migration from PostgreSQL to MariaDB, designed with a focus on structure preservation, relationship integrity, and compatibility. | ||
|
||
--- | ||
|
||
## ⚠️ Warning | ||
## ⚠️ Disclaimer | ||
|
||
**This script is currently under development. Use it at your own risk.** | ||
**This script is no longer actively maintained.** | ||
Initially developed for a specific project, it has received minor updates but still requires further refinement. For instance, enhancements are needed for the migration of **foreign keys** and other aspects. | ||
|
||
The author assumes no liability for any damages or data loss caused by the use of this script. Ensure that you create proper backups of your databases before running the migration. | ||
|
||
Please read this entire `README.md` carefully before proceeding. | ||
The author does not assume responsibility for data loss or damage caused by using this script. **Backup your databases** thoroughly before proceeding. | ||
|
||
--- | ||
|
||
## 🚀 Features | ||
## 🚀 Key Features | ||
|
||
- Automated schema and data migration. | ||
- Foreign key and index preservation. | ||
- Progress tracking and detailed logging. | ||
- Batch processing for optimal performance. | ||
- Enhanced error handling and logging. | ||
- Connection pooling and prepared statements for improved performance. | ||
- **Schema and Data Migration**: Transfers database schemas and data between PostgreSQL and MariaDB. | ||
- **Foreign Key Support**: Includes preliminary handling for foreign keys and indexes. | ||
- **Batch Processing**: Optimized for handling large datasets. | ||
- **Error Handling**: Logs issues encountered during migration for easier debugging. | ||
- **Progress Tracking**: Provides visual progress feedback. | ||
- **Prepared Statements**: Utilizes PDO for secure database interactions. | ||
|
||
--- | ||
|
||
## 🛠️ Installation | ||
## 🛠️ Getting Started | ||
|
||
1. **Clone the repository**: | ||
1. **Clone the Repository** | ||
```bash | ||
git clone https://github.com/PixoVoid-net/pgsql-mariadb-migrate.git | ||
``` | ||
|
||
2. **Navigate to the project directory**: | ||
2. **Navigate to the Project Directory** | ||
```bash | ||
cd pgsql-mariadb-migrate | ||
``` | ||
|
||
3. **Ensure all required PHP extensions are installed**: | ||
- `ext-pdo` | ||
- `ext-pdo_pgsql` | ||
- `ext-pdo_mysql` | ||
3. **Check PHP Extensions** | ||
Ensure the following extensions are installed: | ||
- `ext-pdo` | ||
- `ext-pdo_pgsql` | ||
- `ext-pdo_mysql` | ||
|
||
--- | ||
|
||
## 🔧 Configuration | ||
## 🔧 Configuration Steps | ||
|
||
1. **Copy the example environment file**: | ||
1. **Copy the Example Environment File** | ||
```bash | ||
cp .env.example .env | ||
``` | ||
|
||
2. **Update the `.env` file** with your database credentials and settings. | ||
2. **Edit the `.env` File** | ||
Update database credentials and other settings based on your environment. | ||
|
||
--- | ||
|
||
## 🚀 Usage | ||
## 🚀 Running the Script | ||
|
||
1. **Run the migration script**: | ||
1. **Execute the Migration Tool** | ||
```bash | ||
php migration.php | ||
``` | ||
|
||
2. **Monitor the migration process** through the console output and log files. | ||
2. **Monitor the Output** | ||
The script will display progress in the console and generate detailed logs. | ||
|
||
--- | ||
|
||
## 👨💻 Author | ||
## 📋 Data Type Mapping | ||
|
||
- **PixoVoid** | ||
- Email: [[email protected]](mailto:[email protected]) | ||
- Website: [pixovoid.net](https://pixovoid.net) | ||
- GitHub: [PixoVoid-net/pgsql-mariadb-migrate](https://github.com/PixoVoid-net/pgsql-mariadb-migrate) | ||
The following table outlines how PostgreSQL data types are mapped to MariaDB: | ||
|
||
| PostgreSQL Type | MariaDB Type | Notes | | ||
|------------------------|---------------------|-------------------------------------| | ||
| `smallint` | `INT` | | | ||
| `integer` | `INT` | | | ||
| `bigint` | `BIGINT` | | | ||
| `boolean` | `TINYINT(1)` | `0` = false, `1` = true | | ||
| `character varying` | `VARCHAR(255)` | | | ||
| `text` | `TEXT` | | | ||
| `timestamp` | `DATETIME` | | | ||
| `date` | `DATE` | | | ||
| `numeric` | `DECIMAL(20,6)` | | | ||
|
||
--- | ||
|
||
## 📜 License | ||
## 🔍 Logging and Monitoring | ||
|
||
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. | ||
- **Real-Time Feedback**: Console output shows progress and status updates. | ||
- **Log File**: Issues and migration events are logged in `migration.log`. | ||
- **Message Types**: | ||
- 🟢 Success | ||
- 🔴 Error | ||
- 🟡 Warning | ||
|
||
--- | ||
|
||
## 🤝 Contributing | ||
## 🛠️ Known Issues and TODOs | ||
|
||
Contributions are welcome! Please read the [CONTRIBUTING](CONTRIBUTING.md) file for details on our code of conduct and the process for submitting pull requests. | ||
- **Foreign Key Migration**: Needs significant improvement to handle complex relationships. | ||
- **Performance**: Optimization required for handling extremely large databases. | ||
- **Validation**: Additional checks for data integrity post-migration. | ||
|
||
--- | ||
|
||
## 📞 Support | ||
## 👨💻 About the Author | ||
|
||
- **PixoVoid** | ||
- Email: [[email protected]](mailto:[email protected]) | ||
- Website: [pixovoid.net](https://pixovoid.net) | ||
- GitHub: [PixoVoid-net](https://github.com/PixoVoid-net) | ||
|
||
For support, please contact [[email protected]](mailto:[email protected]) or open an issue on GitHub. | ||
--- | ||
|
||
## 📜 License | ||
|
||
This tool is distributed under the [MIT License](LICENSE). You are free to use, modify, and distribute it under these terms. | ||
|
||
--- | ||
|
||
## 📊 Data Type Mappings | ||
## 🤝 Contributions | ||
|
||
| PostgreSQL Type | MariaDB Type | Notes | | ||
|------------------------|---------------------|-------------------------------------| | ||
| `smallint` | `INT` | | | ||
| `integer` | `INT` | | | ||
| `bigint` | `BIGINT` | | | ||
| `boolean` | `TINYINT(1)` | `0` = false, `1` = true | | ||
| `character varying` | `VARCHAR(255)` | | | ||
| `text` | `TEXT` | | | ||
| `timestamp` | `DATETIME` | | | ||
| `date` | `DATE` | | | ||
| `numeric` | `DECIMAL(20,6)` | | | ||
Contributions are welcome! If you want to improve this tool, feel free to fork the repository and submit a pull request. See [CONTRIBUTING.md](CONTRIBUTING.md) for details. | ||
|
||
--- | ||
|
||
## 🔍 Logging and Monitoring | ||
## 📞 Support | ||
|
||
- Migration progress is displayed in real-time with a visual progress bar. | ||
- All operations are logged to `migration.log`. | ||
- Console output uses color coding for different message types: | ||
- 🟢 **Success** messages | ||
- 🔴 **Error** messages | ||
- 🟡 **Warning** messages | ||
For questions, open an issue on GitHub or contact [[email protected]](mailto:[email protected]). |