andrey-helldar/migrate-db

此包已被弃用,不再维护。作者建议使用 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 许可证 许可。