Xethron / migrations-generator

Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.
MIT License
3.32k stars 588 forks source link

Table exists error when running on multiple db #157

Open omarjebari opened 6 years ago

omarjebari commented 6 years ago

I had to make a bunch of changes to my two databases. I deleted my migrations files and cleared out the migrations tables in both dbs. I ran the generate command on each db and it successfully created the tables, populated the migrations directory and created two migrations tables (one for each database) correctly populated. However when i added a new migration file it gives me an error when i run the artisan migrate command. It looks as though it is cycling through the migration files and trying to run ALL of them on my default db. If i specify a specific db connection in the migration command it still fails because it still tries to run ALL of the migrations on one of the databases. The problem seems to be that neither migrations table has a complete snapshot of the migrations that have been run. It finds a missing one, tries to run it, then realises the table exists in the specific database. Bear in mind that inside my migration files i am specifying the connection (ie db) to create the table on.

agneroalain commented 6 years ago

Hi , I got an error like that , after get migration from my existing database , i wanted to add a new column to a table , so i have edit the corresponding migration file , but when i run "php artisan migrate" he try to recreate again all database so he tell me that they already exist ! (like on the image) ! please someone can help me ? capture