dragon-code / 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 许可证 许可。