Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

anjanesh's avatar

php artisan migrate after altering model data ?

In Django if we want new columns to a table, I'll add the code in the models.py file then do

python3 manage.py makemigrations
python3 manage.py migrate

Can we not do the same in Laravel ? If I understand correctly, in Laravel we have to make the changes in application/migrations and not in the model directly ?

Firstphp artistan migrate:make users_table_add_hometown Add in class Users_Table_Add_Hometown, $table->string('hometown'); and then php artisan migrate

0 likes
2 replies
martinbean's avatar

Can we not do the same in Laravel ?

@anjanesh No. You need to create a migration for the schema change you want to happen.

Laravel doesn’t have a built-in command to “diff” your current schema with your models.

1 like
tykus's avatar
tykus
Best Answer
Level 104

Migrations are the classes we use to alter the database schema, so yes, in Laravel we make a new migration with the schema change(s) and then migrate.

Please or to participate in this conversation.