LaravelLaravel16 min read

Migrations: Version Control for Your Database

Create and manage database tables using Laravel migrations step by step.

Daniel Scott
December 21, 2025
0.0k0

Migrations allow you to define database structure in code and keep it versioned. ## Create a migration ```bash php artisan make:migration create_posts_table ``` ## Example migration ```php public function up(): void { Schema::create('posts', function (Blueprint $table) { $table->id(); $table->string('title'); $table->text('body'); $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('posts'); } ``` ## Run migrations ```bash php artisan migrate ``` ## Migration flow ```mermaid flowchart TD A[Migration file] --> B[php artisan migrate] B --> C[(Database tables)] ``` In the next tutorial, we will work with Eloquent models to interact with this data.

#Laravel#Database#Migrations#Beginner