If I run php artisan migrate
it fails with Base table or view not found: 1146 Table '*.migrations' doesn't exist
.
And the DB is empty.
If I run php artisan migrate:install
I see the migration table but it is empty.
DB shows the migrations table but it is empty.
If I then run php artisan migrate
again the db is empty again and I get the same error: Base table or view not found: 1146 Table '*.migrations' doesn't exist
.
Maybe someone knows whats going on here.
CodePudding user response:
To fix that I needed to add the following code to app/Providers/AppServiceProvider.php
:
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema; # Added this Line
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191); # Added this Line
}
}
Running php artisan migrate:fresh
finally result in:
Dropped all tables successfully.
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table (14.68ms)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table (12.33ms)
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated: 2019_08_19_000000_create_failed_jobs_table (18.95ms)
Thanks a lot to Weber and mathijing!!
CodePudding user response:
Could be a couple of things:
- Try
php artisan migrate:reset
- There could be something wrong in your migration files: check here