Support the ongoing development of Laravel.io →
Database
Last updated 2 years ago.
0
moderator Solution

The only reason I could think of is that you accidentally run migrate before changing the migration. Then it created the table with the first version and running another migrate on the same database will do nothing.

Can you do a migrate:rollback and do it again? I see nothing wrong on your migration.

danallendotcom liked this reply

1

I actually checked for that before starting this thread. Deleted the project, recreated it following a guide.

This morning, I found and fixed the problem. Your answer is so close I marked it as the solution.

Here is an updated STEPS TO REPRODUCE PROBLEM, following a guide for newbies:

  1. Create project using Composer
  2. To simplify learning, change the permissions to make everything in the file writeable (chmod -R 777 newproject) 3 Create the car model (php artisan make:model Car --migration)
  3. Edit the car model, adding fields to the schema.
  4. Save changes <-- this is where the fail occurred.

The migration file is created with write permission only for the user that ran the command for creating the model. However, my code editor is logged into the server with a different user. When I tried saving, I wrongly assumed the migration file had the same permissions as all the files got when I set the file directory recursively to give everyone write permissions. In the code editor, there is a badge on the file when there are unsaved changes. Unfortunately, the badge turns off when file-save fails. A warning pops up, but it is easy to miss if you are not looking for it.

Bottom line, you were 100% correct, the migration occurred without the fields being in the migration file. Your were right that nothing was wrong. I did the rollback and re-migrated, everything is perfect now.

Thank you for taking the time to answer my question. I appreciate it a lot, because i know you didn't have to do that.

Last updated 3 years ago.

tvbeek liked this reply

1
moderator

Thanks for your friendly reply :) That is a big motivator to keep taking time to answer questions :)

And thanks for explaining what happen, that can help other people who have the same problem.

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.

© 2024 Laravel.io - All rights reserved.