skip to Main Content

this is an existing project and I used to use php artisan migrate:fresh command a lot, this morning it suddenly stopped working for no reason.

I am really confused.

When I run migrate:fresh I can see this output in the terminal:

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

   INFO  Nothing to migrate.

but it isn’t actually dropping anything. All the tables are there and migrations table is populated so it won’t do anything more.

Literally nothing has changed and it suddenly stopped working.

Environment details:

Laravel 9.52
PHP 8.2
MacOS 13.3.1
Postgres 15.2

Any help greatly appreciated

It migrates fine when I delete database and re-create it manually.

So far I have tried clearing cache, dumping autoload, etc. but it makes no difference.

2

Answers


  1. Chosen as BEST ANSWER

    OK the solution was simple - I have added following to my default connection settings in config/database.php:

    'schema' => 'public',
    

  2. In Laravel, the migrate:fresh command is designed to drop all tables and re-run all migrations from scratch. However, it relies on the migrations table to determine which migrations have been applied.

    I think your migrations table are out of sync with the actual state of the database. This can happen if the table was modified manually or if a migration file was modified or deleted without using Laravel’s migration system.

    To resolve this, you can try manually resetting the migrations table by running the following command:

    php artisan migrate:reset
    

    After resetting the migrations table, you can attempt to run migrate:fresh again.

    Hope my answer give you a hint.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search