Support the ongoing development of Laravel.io →
posted 5 years ago
Database

I have tow database connections,

`'mysql' => [
            // connection information
    ],

    'test' => [
    // connection information
    ],`

while I run migrate:fresh command, it only drop migrations with default connection (mysql) not other connection (test).

How can I resolve this?

If I run php artisan migrate with fresh database, it create all table on all connections. Also, If I run php artisan migrate:rollback it rollback from all connections.

Last updated 3 years ago.
0
moderator

You can run any artisan command with -h to see the options. Example: php artisan migrate -h

There you see that you can add --database[=DATABASE] to select the connection to use.

In your situation it will work with:
php artisan migrate --database=test
php artisan migrate:fresh --database=test
php artisan migrate:rollback --database=test

Last updated 5 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.