Migration in Laravel.

Migrations are like version control for our database. Means we don’t have to worry about versions of the database and laravel because it interacts with the database by command, we don’t need to interact with the database manually. By using migration, we create/define tables, structures, seeds value in the database. We also don’t need to add columns manually in the database.

How to create a migration.

To create migration we call a command, see below:-

After hitting Enter migration creates. See below how it looks:-

How to add columns in Database by migration.

To add a column, we open our migration and add column in up function and use migrate command to add in database. See below how:-

After adding column we call migrate command to add in the database.

Column migrated in database. See below:-