Migrations and Seeders help you manage database structure and data programmatically, making your project easy to version, share, and deploy.
A PHP file that defines database schema changes
Version control for your database
Allows easy rollback and updates
Rollback:
Inserts sample or default data into tables
Useful for testing and development
In .env:
In app/Config/Migrations.php:
✅ Use migrations for all schema changes
✅ Never edit DB manually in production
✅ Seed only non-sensitive data
❌ Don’t use seeders for production user data
| Feature | Migrations | Seeders |
|---|---|---|
| Purpose | DB structure | DB data |
| Versioned | Yes | No |
| Rollback | Yes | No |
Migrations manage database schema
Seeders populate initial/sample data
Essential for teamwork and deployment
Fully supported via Spark CLI
Take quizzes related to this topic and see where you stand!
Start Quiz Now