Overview
Dashboard Laravel uses Laravel’s migration system to manage database schema changes. Migrations are version control for your database, allowing your team to define and share the application’s database schema definition.Available Migrations
The application includes the following migration files:Core Laravel Migrations
Core Laravel Migrations
users, password_reset_tokens, sessions
File:0001_01_01_000000_create_users_table.phpCreates the authentication system tables including users, password reset tokens, and session management.cache
File:0001_01_01_000001_create_cache_table.phpCreates cache storage tables for improved performance.jobs
File:0001_01_01_000002_create_jobs_table.phpCreates queue job tables for background processing.Application Migrations
Application Migrations
homes
File:2026_03_03_021430_create_homes_table.phpCreates the homes table for managing homepage content.estadisticas
File:2026_03_03_022050_create_estadisticas_table.phpCreates the statistics table for tracking product sales and analytics.clientes
File:2026_03_03_191644_create_clientes_table.phpCreates the clients/customers table with segmentation support.ventas
File:2026_03_03_191659_create_ventas_table.phpCreates the sales table with foreign key relationship to clients.facturas
File:2026_03_03_191710_create_facturas_table.phpCreates the invoices table linked to clients and sales.mensajes
File:2026_03_03_191720_create_mensajes_table.phpCreates the messages table for client communication.nosotros
File:2026_03_04_014709_create_nosotros_table.phpCreates the about us table for company information.Running Migrations
- Run All Migrations
- Fresh Migration
- With Seeding
Migration Commands
Check the status of all migrations
Rollback the last batch of migrations
Rollback all migrations
Rollback all migrations and re-run them
Example Migration
Here’s a real example from the clientes table migration:Creating New Migrations
To create a new migration:Best Practices
Migration Guidelines
Migration Guidelines
- Never modify existing migrations that have been committed and run in production
- Always create new migrations for schema changes
- Use descriptive names for your migration files
- Test rollback functionality to ensure
down()methods work correctly - Use foreign key constraints to maintain referential integrity
- Set default values where appropriate to avoid null issues
- Index frequently queried columns for better performance
Foreign Key Example
The ventas table demonstrates proper foreign key usage:onDelete('cascade') ensures that when a client is deleted, all their sales are also deleted automatically.