A PHP-based tool to facilitate database migration from PostgreSQL to MariaDB, designed with a focus on structure preservation, relationship integrity, and compatibility.
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 does not assume responsibility for data loss or damage caused by using this script. Backup your databases thoroughly before proceeding.
- 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.
-
Clone the Repository
git clone https://github.com/PixoVoid-net/pgsql-mariadb-migrate.git
-
Navigate to the Project Directory
cd pgsql-mariadb-migrate
-
Check PHP Extensions
Ensure the following extensions are installed:ext-pdo
ext-pdo_pgsql
ext-pdo_mysql
-
Copy the Example Environment File
cp .env.example .env
-
Edit the
.env
File
Update database credentials and other settings based on your environment.
-
Execute the Migration Tool
php migration.php
-
Monitor the Output
The script will display progress in the console and generate detailed logs.
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) |
- 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
- 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.
- PixoVoid
- Email: contact@pixovoid.net
- Website: pixovoid.net
- GitHub: PixoVoid-net
This tool is distributed under the MIT License. You are free to use, modify, and distribute it under these terms.
Contributions are welcome! If you want to improve this tool, feel free to fork the repository and submit a pull request. See CONTRIBUTING.md for details.
For questions, open an issue on GitHub or contact contact@pixovoid.net.