php - 在迁移 :refresh with --path option 时找不到 Laravel 5.5 迁移

标签 php mysql laravel database-migration eloquent

在使用 --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/

相关文章:

PHP默认参数函数调用

java - Google App Engine 在与 Java 相同的项目中查询 MySQL

php - 棘手的mysql计算日期范围内每一天的出现次数

mysql - Laravel 5.1 的表锁定问题

javascript - Ajax验证和SyntaxError : JSON Parse error: Unrecognized token '<' on Laravel

php - "JSON text did not start with array or object and option to allow fragments not set."

php - PHP 中的奇异值分解 (SVD)

php - 如何在 CodeIgniter 的同一 Controller 中将数据/变量从一种方法发送到另一种方法?

使用 React 应用程序的 Google Cloud SQL 中的 MYSQL 连接错误

php - 拉维尔 4 : validate checkbox at least one