Database migration is like the version control of the database, which allows the team to modify and share the database schema of the application. Database migrations are paired with the schema builder of Laravel which is used to build the database schema of the application.

It is a type of version control for our database. It is allowing us to modify and share the application's database schema easily.

A migration file contains two methods up() and down().

up() is used to add new tables, columns, or indexes database, and the down() is used to reverse the operations performed by the up method.

You can generate a migration & its file with the help of make:migration

Syntax : php artisan make:migration blog

A current_date_blog.php file will be created in database/migrations.

BY Best Interview Question ON 17 Sep 2022

Suggest An Answer