0

I have a Laravel 5.3 site and I suspect I made some manual database changes without using the Laravel migrate functionality and now it is biting me...

Now I am trying to get to a stable database situation.

Here was my migrations folder yesterday:

create_sometable1_table
create_sometable2_table
create_sometable3_table

And so on.

Then I added via

php artisan make:migration create_newtable_table

But later renamed the migration file and the model file to create_newtabledifferentname_table

Then I tried to add another table using

php artisan make:migration create_anothertable_table

But I get

  [InvalidArgumentException]                       
  A CreateAnothertableTable migration already exists.  

I ran the usual commands to try and get things into normal state, like cache:clear, and the recommended composer commands (like autoload).

But nothing works.

In my DB these tables don't exist and the migration file create_anothertable_table doesn't exist.

So I ran

php artisan migrate:rollback

And this resulted in all but 3 of my tables disappearing, with 3 now remaining in the database. The 3 remaining ones are not the ones of interest.

Anyway, I have all my tables and data on my live site and am just trying to get things locally looking the same, so no big deal that my DB on localhost is currently messed up.

Just need to know, how to get things into a stable state from this point onward?

Thanks!

Brian

Brian
  • 561
  • 5
  • 16
  • 1
    there is a migration table in your database check there is ```create_anothertable_table``` or not – Mohammad Fanni Sep 11 '19 at 09:37
  • 1
    When you renamed the migration file, did you also change the class name inside the file? – Bram Verstraten Sep 11 '19 at 09:37
  • Try doing php artisan migrate:fresh. Caution: it will empty all the db schema – Sachin Bahukhandi Sep 11 '19 at 09:39
  • Realized I didn't change the class name, looking into everything now! But what is still odd is that yesterday when I ran the migration create command even though it returned with no error the table was never created. – Brian Sep 11 '19 at 09:41
  • Ok, I tried to get things starting from fresh so followed some steps here: https://stackoverflow.com/questions/46129270/laravel-5-5-error-base-table-or-view-already-exists-1050-table-users-already/47326189. – Brian Sep 11 '19 at 09:54

0 Answers0