'Issue when trying to run two migrations with same name in different folders Laravel
I have two folders in my migrations:
database/migrations/simulatordatabase/migrations/tasks
Inside each one i have a migration for users like: create_users_table.
And each migration inside a folder have different connections to different databases like this e.g.:
Schema::connection('mysql_simulator')
->create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->rememberToken();
$table->timestamps();
});
The issue is: Laravel don't allow me to run these migrations properly.
When i try to run this command: php artisan migrate --path="database/migrations/simulator"
The users table migrate normally, but if after that i try to run the same with tasks folder: php artisan migrate --path="database/migrations/tasks"
I got this error: Nothing to migrate.
But if i try to reset my migrations from tasks folder: php artisan migrate:reset --path="database/migrations/tasks
It shows me that:
Migration not found: 2021_02_13_194359_create_textures_table
Migration not found: 2021_02_04_224957_create_image_simulation_table
Migration not found: 2021_02_03_192318_create_images_table
Migration not found: 2021_01_29_170555_create_simulations_table
Migration not found: 2021_01_29_170326_create_addresses_table
Migration not found: 2021_01_29_170138_create_phones_table
Migration not found: 2019_08_19_000000_create_failed_jobs_table
Migration not found: 2014_10_12_100000_create_password_resets_table
Migration not found: 2014_10_12_000000_create_users_table
Migration not found: 2021_03_10_213837_create_users_table
Basically it shows me all the tables from the other folder (not the one i run the command) i ran my tasks migration but it showed me that all my simulator migrations was not found.
So i don't know that is happening, seems like Laravel is reading all migrations from different folders as one, i just need to create the same migration name in different folders and run it without conflicts, is it possible in Laravel?.
Solution 1:[1]
probably these are migrations that you have removed them from your project migrations directory after a successful migrate,
when you run php artisan migrate
Laravel logs the successful ones in migrations table in your DB , so when you delete them , this error comes up , try to delete them from migrations table also
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Neo Mn |
