在使用 --path 选项运行 migrate:refresh 时,我得到“找不到迁移”。
似乎脚本试图回滚所有迁移,而不仅仅是指定的迁移。
php artisan migrate:refresh --path=packages/package/src/database/migrations
Migration not found: 2016_06_01_000005_create_oauth_personal_access_clients_table
Migration not found: 2016_06_01_000004_create_oauth_clients_table
Migration not found: 2016_06_01_000003_create_oauth_refresh_tokens_table
Migration not found: 2016_06_01_000002_create_oauth_access_tokens_table
Migration not found: 2016_06_01_000001_create_oauth_auth_codes_table
Migration not found: 2014_10_12_100000_create_password_resets_table
Migration not found: 2014_10_12_000000_create_users_table
最后的结果其实还好。它刷新指定的文件夹迁移。
最佳答案
The migrate:refresh command will roll back all of your migrations and then execute the migrate command. This command effectively re-creates your entire database:
migrate:refresh 将遍历迁移表中的所有迁移以回滚它们。由于您指定了路径,因此它正在查找该路径中的所有迁移。
所以本质上它会抛出错误,因为它无法在您指定的路径中找到那些迁移,但它仍会按您预期的那样工作,因为它正在回滚并重新运行它确实找到的迁移。
您通常不需要路径选项。通常,您要么发布包的迁移(将它们复制到您的数据库/迁移目录),要么包的服务提供商将定义可以找到迁移的位置。 Refresh 期望回滚所有迁移,而不是特定迁移,因此虽然它可能在此示例中起作用,但它不是预期用途。
关于php - 在迁移 :refresh with --path option 时找不到 Laravel 5.5 迁移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49631844/