Laravel: Database Migrations
Laravel database migrations are like version control for your database, allowing you to modify and share the application’s database schema. Laravel Schema facade provides database agnostic support for creating and manipulating tables across all of Laravel’s supported database systems.
How to create a migration?
We can create database migration by using the Artisan command make:migration New migration file be placed in project database/migrations directory. And each migration file name contains with timestamp, which allows Laravel to determine the order of the migrations.
Migration File Structure and Creating Table
Laravel migration class contains two methods: up and down. The up method is used to add new tables, columns, or indexes to your database, while the down method should reverse the operations performed by the up method. To create a new database table by using Schema::create method.
Run all Migrations
Please execute the migrate Artisan command to run all of your created migrations:
Roll Back or Refresh Migrate Using Artisan Command
Artisan migrate:refresh command will roll back all of your migrations and then execute the migrate command. This command effectively re-creates your entire database.
Thank you for carefully read my article If you have any query please Leave your query on following comment section or contact with us. Please LIKE and SHARE