#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →

Creating and Running Migrations

Migrations give a Laravel application a reliable, version-controlled way to build and evolve its database schema. Instead of applying changes manually on each environment, migrations describe those changes once, in code that travels with the rest of the project.

Creating a Migration

New migrations are generated through Artisan, producing a timestamped file inside database/migrations. The timestamp ensures migrations always run in the order they were created, which matters when later files depend on tables created earlier.

Structuring a Migration

Each migration file defines two methods: up(), which describes the changes to apply, and down(), which describes how to reverse them. This pairing is what makes migrations safely reversible.

CommandWhat It Does
php artisan make:migration create_posts_tableCreates a new migration file
php artisan migrateRuns all pending migrations
php artisan migrate:rollbackReverses the most recent batch of migrations
php artisan migrate:freshDrops all tables and re-runs every migration from scratch

Why Migrations Matter

Creating tables is only the starting point — real applications constantly evolve, which means migrations are just as often used to add columns and modify existing tables.

Ready to master Laravel Training Course?

Join Uncodemy's hands-on Laravel program and build real, production-ready applications.

Explore Course