【问题标题】:Laravel 8 migrate does not found migrations tableLaravel 8 迁移未找到迁移表
【发布时间】:2021-11-07 07:39:03
【问题描述】:

我正在尝试将我的表迁移到 laravel 数据库中,但是 artisan 没有找到 migrations 表。

我已经尝试过,从其他 laravel 安装中手动导入结构创建迁移,但错误仍然存​​在

我还使用 php aritsan migration:install comand 创建了迁移表

但是我注意到,当我运行 php artisan migrate 时,迁移表正在被删除,然后显示该表不存在的错误。

查看下面的完整错误

$ php artisan migrate
Migration table created successfully.
Loading stored database schema: /path/to/laravel/project/database/schema/mysql-schema.sql
Loaded stored database schema. (15.32ms)

Illuminate\Database\QueryException 

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'test_db.migrations' doesn't exist (SQL: select `migration` from `migrations` order by `batch` asc, `migration` asc)

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
    667▕         // If an exception occurs when attempting to run a query, we'll format the error
    668▕         // message to include the bindings with SQL, which will make this exception a
    669▕         // lot more helpful to the developer instead of just the database's errors.
    670▕         catch (Exception $e) {
➜ 671▕             throw new QueryException(
    672▕                 $query, $this->prepareBindings($bindings), $e
    673▕             );
    674▕         }
    675▕ 

    +31 vendor frames 
32  artisan:37
    Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

技术细节:

  • Laravel 8.6
  • MariaDB 15.1

【问题讨论】:

  • 你的数据库中是否存在迁移表?
  • 是的,但是当我运行 php artisan migrate 时被消除并显示错误。
  • 能否也显示第一个迁移代码?
  • 摆脱模式转储是第一步
  • 这是我使用的第一个,因为在文档中建议,但没有奏效。需要按以下顺序完成:1. php artisan migrate:install, 2. php artisan schema:dump, 3. php artisan migrate。谢谢!

标签: php laravel laravel-8


【解决方案1】:

如果您可以放下和擦拭: 能否请您运行 php artisan db:wipe,然后运行 ​​artisan migrate 并告诉我结果?

【讨论】:

    猜你喜欢
    • 2014-02-28
    • 2013-10-16
    • 2019-02-07
    • 2015-08-29
    • 2017-01-16
    • 2019-02-05
    • 1970-01-01
    • 1970-01-01
    • 2013-09-26
    相关资源
    最近更新 更多