Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Base table or view not found on fresh migration

I am trying to perform a migration and seeding the tables on a fresh app/server using:

php artisan migrate:refresh --seed

I am however getting the following error: Image

php artisan migrate:fresh --seed

                                                                                     
                             APPLICATION IN PRODUCTION.                              
                                                                                     

 ┌ Are you sure you want to run this command? ──────────────────┐
 │ Yes                                                          │
 └──────────────────────────────────────────────────────────────┘


  Dropping all tables ................................................... 13ms DONE

   INFO  Preparing database.  

  Creating migration table .............................................. 31ms DONE

   INFO  Loading stored database schemas.  

  database/schema/mysql-schema.sql ...................................... 47ms DONE


   Illuminate\Database\QueryException 

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'svadbenilokali.migrations' doesn't exist (Connection: mysql, SQL: select `migration` from `migrations` order by `batch` asc, `migration` asc)

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:822
    818▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    819▕                 );
    820▕             }
    821▕ 
  ➜ 822▕             throw new QueryException(
    823▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    824▕             );
    825▕         }
    826▕     }

  i   A table was not found: You might have forgotten to run your database migrations. 
      https://laravel.com/docs/master/migrations#running-migrations

      +37 vendor frames 

  38  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

I tried performing the migration and seed separately as well as removing auth from route without any success. The migrations and seeds are working fine locally. Could someone point me in the right direction please?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

it seems like you may have already run the command php artisan schema:dump before. If that’s the case, please be aware that the generated file at database/schema/mysql-schema.sql does not include the migration table.

Delete the existing file and then run the command again.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading