Skip to content

数据库迁移脚本向不同的连接库迁移问题 #70

@zhangyue0503

Description

@zhangyue0503

在使用 https://github.com/php-casbin/think-authz/ 的时候发现定义了它的 connection 配置,也无法在指定的连接库中创建表,还是会创建到默认连接的库中

在 topthink/think-migration/src/command/Migrate.php 的 executeMigration() 方法中发现

$migration->setAdapter($this->getAdapter());

这一行的 getAdapter() 方法会直接使用 config 中指定的 default 的连接,即我在迁移脚本中指定了自己想要连接的数据库也无效,要在指定的连接库中创建表只能去改整体的 database.default

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions