Google News
logo
Laravel - Interview Questions
Explain database migrations in laravel.
Migrations are like version control for the database. With migration team can easily modify the database schema, migrations are paired with Laravel’s schema builder to easily build application’s db schema. With Laravel Schema facade creating and manipulating tables across the application is very easy. Artisan command to create migration schema is php artisan make:migration create_employeess_table. New migrations will be stored in database/migrations directory. Each migration will along with migration name contains the timestamp of the creation of file which helps Laravel to order migrations.
 
The --table and --create options may be used to indicate the name of the table and whether the migration will be creating a new table. These options pre-fill the generated migration stub file with the specified table:
 
* php artisan make:migration create_employees_table --create=employees

* php artisan make:migration add_departments_to_employee_table --table=employees
Advertisement