andrey-helldar / migrate-db
3.2.0
2024-03-15 00:04 UTC
Requires
- php: ^8.0
- ext-pdo: *
- doctrine/dbal: ^3.0
- dragon-code/contracts: ^2.15
- dragon-code/support: ^6.0
- illuminate/contracts: ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/database: ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/support: ^8.0 || ^9.0 || ^10.0 || ^11.0
Requires (Dev)
- ext-pdo_mysql: *
- ext-pdo_pgsql: *
- mockery/mockery: ^1.0
- orchestra/testbench: ^6.0 || ^7.0 || ^8.0 || ^9.0
- phpunit/phpunit: ^9.6 || ^10.0
README
轻松实现数据库之间的数据迁移
安装
要获取最新的 Migrate DB
版本,只需使用 Composer 需求项目。
composer require dragon-code/migrate-db --dev
或手动更新 require-dev
块的 composer.json
文件并运行 composer update
。
{ "require-dev": { "dragon-code/migrate-db": "^3.0" } }
兼容性
用法
在 config/database.php 文件的 connections
部分创建一个新的数据库,并设置两个连接,然后运行带有两个参数的 db:migrate
控制台命令。
php artisan db:migrate --schema-from=foo --schema-to=bar
仅迁移特定表
php artisan db:migrate --schema-from=foo --schema-to=bar --tables=table1 --tables=table2 --tables=table3
排除特定表
php artisan db:migrate --schema-from=foo --schema-to=bar --exclude=table1 --exclude=table2 --exclude=table3
其中
遵循屏幕上的说明,然后命令将在源和目标数据库上执行所有迁移,并将所有记录从旧数据库迁移到新数据库。
祝您使用愉快 😊
许可证
此包根据 MIT 许可证 许可。