2
votes

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
Well do you have a migrations table in your database? - lukasgeiter
According to the tutorial, running the migrate:refresh command should populate the database. - Isaac Eiland-Hall
Tried "php artisan migrate" and that appears to have worked. - Isaac Eiland-Hall

1 Answers

3
votes

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.