Published 4 months ago by herrygallery
In Providers - App Service Provider, I wrote :
Then I manually drop all of my tables from XAMPP including Options table above to test my migration and seed. Then got error :
SQLSTATE[42S02]: Base table or view not found: 1146
If I delete the above code in the App Service Provider, everything works OK.
Is my code wrong? Do I have to adjust the code in App Service Provided to refresh my tables?
You can't just run
php artisan migrate because the same
Base table or view not found exception will occur. Ideally, you would not have a DB query inside a ServiceProvider, but since you do, you will need to comment out that line before you can run migrations.
As a longer term solution, you could wrap that line in a
try catch so that the QueryException does not prevent running the migrations in the first instance.
@tykus thanks for the suggestions. I will try that, its new for me. Using DB query inside the View share is just so convenient, because I have so many options regarding user preference e.g. colors, thumbnail image per row, collapse in/out, pagination, width and height of sketchpad js, etc.