做一个 Laravel 教程,得到“未找到基表或视图:1146 表 'sdbd_todo.migrations' 不存在”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27511709/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Doing a Laravel tutorial, getting "Base table or view not found: 1146 Table 'sdbd_todo.migrations' doesn't exist"
提问by Isaac Eiland-Hall
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
您现在应该可以根据需要多次调用 migrate 并且它会起作用:
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
frommigrations
)[PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sdbd_todo.migrations' doesn't exist
[Illuminate\Database\QueryException]
SQLSTATE[ 42S02] : Base table or view not found: 1146 Table 'sdbd_todo.migrations' 不存在(SQL:选择 max(batch
) 作为聚合
自migrations
)[PDOException]
SQLSTATE[42S02]:未找到基表或视图:1146 表“sdbd_todo.migrations”不存在
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. :)
完全披露:我是 Laravel 的新手,对于 Stack Overflow 来说,请放轻松。:)
采纳答案by Aken Roberts
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
如果它还不存在,将为您创建迁移表,然后运行任何和所有尚未运行的迁移。
php artisan migrate:refresh
is for resetting all existing migrations, then running them again. It expects the migrations table to already exist.
php artisan migrate:refresh
用于重置所有现有迁移,然后再次运行它们。它期望迁移表已经存在。
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.
您可以使用php artisan list
列出所有可用的 Artisan 命令及其描述,以了解有关这些和其他与迁移相关的命令的更多信息。