MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

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:-

Terminal running php artisan make:migration demo_migration --create=demo, labeling migration and table names

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

Laravel migration class with up() creating the demo table and down() dropping it, annotated

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:-

Laravel migration up() function adding name string and address text columns to the sushants table

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

Git Bash terminal running php artisan migrate in the demo-project folder

Column migrated in database. See below:-

PhpMyAdmin showing sushants table with id, name, address, created_at and updated_at columns created

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
With MotoShare.in, you can book a bike instantly, enjoy doorstep delivery, and ride without worries. Perfect for travelers, professionals, and adventure enthusiasts looking for a seamless mobility solution.

Related Posts

How to display a table in a Verticle or Horizontal form in the Laravel PHP Framework? Part-1

How to display a table in a Verticle or Horizontal form in the Laravel PHP Framework? How to Store Seed file into Database. Click There are two…

Read More

Simple Ajax CRUD Application in Laravel

Step 1 – Create a fresh laravel projet First off all , create a project using following command given below – Change Directory to AjaxCrud folder Step…

Read More

HOW TO CREATE EVENT CALENDAR IN LARAVEL? PART-3

Step 1.Create a Database in phpMyAdmin. (Write the same name of database which was written in .enf databse name). Step 2.  We use the migrate command to…

Read More

HOW TO CREATE EVENT CALENDAR IN LARAVEL? PART-2

Step 1.Create a Laravel Project Firstly, Create a new project in laravel, so we open Git Bash,  Go to My Computer/This PC–>LocalDisk(C:)–>Xampp–>Htdocs (Press right click on Mouse)…

Read More

CRUD Operations in Laravel PHP Framework

Step 1 – Download Laravel 5.8 In first step you have to download Laravel 5.8 version. For this you have to go to command prompt, in which…

Read More

How to file upload in DB With local folder using laravel 5.8

Step:1 you have to make these(A) – php artisan make:controller ImageUploadController(B) – php artisan make:model ImageUpload -m Step:2 Open the welcome.blade.php page then write this code. Step:3…

Read More