One of my team members added some columns to the production database table using phpMyAdmin. Afterwards I saw that the data wasn’t matching so i decided to create the migration files for the new columns. Now when I try to run php artisan migrate
in the production environment I am getting duplicate column error because the columns already exist in the database. How can I handle this problem in Laravel?
I have considered removing the columns manually from the database and then running the migrations but this may result in data loss.
Is there any way to modify the migration without dropping the existing columns?
2
Answers
You could use
hasColumn
.More information on the document
you can check in your migration file