Beginners Laravel Migrations Tutorials

Laravel Migrations create database table

Google+ Pinterest LinkedIn Tumblr

Today, We are going to learn Laravel Migrations to creating the new database table. We can manage version control for our database using Laravel Migrations. Migration is really helpful for managing database when we work with developer team. Laravel Migration allows your team to easily manage and share application database scheme. Migration is pair with Laravel database Schema builder to easily build your application database schema.

When We are working with a developer team then One of our team member require a new column to the table. When team member manually adds the column to the database table. At that time we need to share database schema with all team member and it’s hard to manage database. Laravel Migrations solve that problem now we can easily share the database scheme with team member. We just need to create the migration for adding the new column then follow the artisan migrate command for update the database schema.

Laravel Migrations

We are going to learn How to create the table using Laravel Migrations and generate the database table schema. So, First of all, we are going to create migration file by following artisan command.

I hope you install Laravel If not yet just follow this tutorial.

The new migration will generate into database/migrations directory. Each migration file name contains a timestamp which allows Laravel to determine the order of the migrations. Open the Migration file and create the columns for a table like

Finally, We are ready with the first Laravel Migration file. We cover the all basic column data types for more detail visit migration document here. Now let’s run the migration file by following the artisan command

It’s too easy to manage database tables using Laravel Migrations. We just need to create the migration file then run the migration using artisan command.

 

Leave a Reply