Easy data transfer from one database to another
To get the latest version of Migrate DB, simply require the project using Composer:
composer require dragon-code/migrate-db --devOr manually update require-dev block of composer.json and run composer update.
{
"require-dev": {
"dragon-code/migrate-db": "^3.0"
}
}| Service | Versions |
|---|---|
| PHP | ^8.0 |
| Laravel | ^8.0, ^9.0, ^10.0, ^11.0, ^12.0 |
| Databases | MySQL 5.7+, PostgreSQL 9.5+, MSSQL |
| Laravel \ PostgreSQL | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
|---|---|---|---|---|---|---|---|---|---|
| 8 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| 9 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| 10 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| 11 | ✖️ | ✖️ | ✖️ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| 12 | ✖️ | ✖️ | ✖️ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Create a new database and set up both connections in the connections section of
the config/database.php file, then run the db:migrate console command passing two
parameters:
php artisan db:migrate --schema-from=foo --schema-to=barphp artisan db:migrate --schema-from=foo --schema-to=bar --tables=table1 --tables=table2php artisan db:migrate --schema-from=foo --schema-to=bar --exclude=table1 --exclude=table2where:
foo- Source connection namebar- Target connection name
Follow on screen instructions and then command will perform all migrations on the source and destination databases and transfer all records from the old to the new one.
Enjoy 😊
This package is licensed under the MIT License.