dragon-code/migrate-db

轻松实现数据库之间的数据迁移

3.2.0 2024-03-15 00:04 UTC

README

Migrate DB

Stable Version Total Downloads Github Workflow Status License

轻松实现数据库之间的数据迁移

安装

要获取最新版本的 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 许可证 许可。