dragon-code / migrate-db
Easy data transfer from one database to another
Installs: 12 240
Dependents: 0
Suggesters: 0
Security: 0
Stars: 157
Watchers: 6
Forks: 4
Open Issues: 0
pkg:composer/dragon-code/migrate-db
Requires
- php: ^8.0
- ext-pdo: *
- dragon-code/contracts: ^2.15
- dragon-code/support: ^6.0
- illuminate/contracts: ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0
- illuminate/database: ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0
- illuminate/support: ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0
Requires (Dev)
- ext-pdo_mysql: *
- ext-pdo_pgsql: *
- doctrine/dbal: ^3.0 || ^4.0
- mockery/mockery: ^1.0
- orchestra/testbench: ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- phpunit/phpunit: ^9.6 || ^10.0 || ^11.0
Suggests
- doctrine/dbal: [For Laravel 8-10] Required to rename columns and drop SQLite columns (^3.5.1).
README
Easy data transfer from one database to another
Installation
To get the latest version of Migrate DB, simply require the project using Composer:
composer require dragon-code/migrate-db --dev
Or manually update require-dev block of composer.json and run composer update.
{
"require-dev": {
"dragon-code/migrate-db": "^3.0"
}
}
Compatibility
| 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 | ✖️ | ✖️ | ✖️ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Usage
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=bar
For Certain Tables
php artisan db:migrate --schema-from=foo --schema-to=bar --tables=table1 --tables=table2
Exclude Certain Tables
php artisan db:migrate --schema-from=foo --schema-to=bar --exclude=table1 --exclude=table2
where:
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 😊
License
This package is licensed under the MIT License.