Doing a Laravel tutorial, getting “Base table or view not found: 1146 Table 'sdbd_todo.migrations' doesn't exist”

六眼飞鱼酱① 提交于 2020-01-14 02:31:10

问题


Working through this tutorial, I'm down to the following step:

You should now be able to call migrate as many times as you want and it’ll work:

php artisan migrate:refresh

Upon running that command, I get the following errors:

[Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sdbd_todo.migrations' doesn't exist (SQL: select max(batch) as aggregate
from migrations)

[PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sdbd_todo.migrations' doesn't exist

Googling about the error (obviously without the site-specific table name) doesn't find any answers that seem to help.

Full disclosure: I'm new to Laravel, and to Stack Overflow for that matter, please go easy on me. :)


回答1:


php artisan migrate will create the migrations table for you if it does not exist yet, then run any and all migrations that have not been run yet.

php artisan migrate:refresh is for resetting all existing migrations, then running them again. It expects the migrations table to already exist.

You can use php artisan list to list all available Artisan commands and their descriptions to learn more about these and other migration-related commands.



来源:https://stackoverflow.com/questions/27511709/doing-a-laravel-tutorial-getting-base-table-or-view-not-found-1146-table-sdb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!