问题
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
frommigrations
)[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