0
我最近從Gitlab克隆了一個Laravel項目,並在嘗試php artisan migrate
時收到錯誤。 錯誤:Git克隆laravel項目不會遷移
[Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'blog.articles' doesn't exist (SQL: select count(*) as aggregate from `articles` where `published` = 1)
[PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'blog.articles' doesn't exist
.ENV:
APP_ENV=local
APP_DEBUG=true
APP_KEY=UQ6ZJpBveXSQUC0q5lUzdnHb6qzwkLxo
DB_CONNECTION=mysql
DB_HOST=localhost
DB_DATABASE=blog
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
database.php中:
'default' => env('DB_DRIVER', 'mysql'),
// . . .
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'blog'),
'username' => env('DB_USERNAME', 'homestead'),
'password' => env('DB_PASSWORD', 'secret'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
是什麼這個問題的原因是什麼?
P.S
我試圖從Homestead運行該項目。
編輯1
看來,有些依賴於表的代碼遷移之前運行。