Overview
Laravel Breeze API includes database migrations for authentication, sessions, and background jobs. All migrations follow Laravel’s migration conventions.Running Migrations
Fresh Migration
Reset and Migrate
Rollback
Core Migrations
Users Table
File:database/migrations/0001_01_01_000000_create_users_table.php
Creates the users table, password reset tokens table, and sessions table.
users
| Column | Type | Attributes |
|---|---|---|
| id | BIGINT UNSIGNED | Primary key |
| name | VARCHAR(255) | Required |
| VARCHAR(255) | Unique | |
| email_verified_at | TIMESTAMP | Nullable |
| password | VARCHAR(255) | Hashed |
| remember_token | VARCHAR(100) | Nullable |
| created_at | TIMESTAMP | Auto |
| updated_at | TIMESTAMP | Auto |
password_reset_tokens
| Column | Type | Attributes |
|---|---|---|
| VARCHAR(255) | Primary key | |
| token | VARCHAR(255) | Required |
| created_at | TIMESTAMP | Nullable |
sessions
| Column | Type | Attributes |
|---|---|---|
| id | VARCHAR(255) | Primary key |
| user_id | BIGINT UNSIGNED | Foreign key, nullable, indexed |
| ip_address | VARCHAR(45) | Nullable |
| user_agent | TEXT | Nullable |
| payload | LONGTEXT | Required |
| last_activity | INTEGER | Indexed |
Cache Table
File:database/migrations/0001_01_01_000001_create_cache_table.php
cache
| Column | Type | Attributes |
|---|---|---|
| key | VARCHAR(255) | Primary key |
| value | MEDIUMTEXT | Required |
| expiration | INTEGER | Indexed |
cache_locks
| Column | Type | Attributes |
|---|---|---|
| key | VARCHAR(255) | Primary key |
| owner | VARCHAR(255) | Required |
| expiration | INTEGER | Indexed |
Jobs Tables
File:database/migrations/0001_01_01_000002_create_jobs_table.php
jobs
| Column | Type | Attributes |
|---|---|---|
| id | BIGINT UNSIGNED | Primary key |
| queue | VARCHAR(255) | Indexed |
| payload | LONGTEXT | Required |
| attempts | TINYINT UNSIGNED | Required |
| reserved_at | INTEGER UNSIGNED | Nullable |
| available_at | INTEGER UNSIGNED | Required |
| created_at | INTEGER UNSIGNED | Required |
job_batches
| Column | Type | Attributes |
|---|---|---|
| id | VARCHAR(255) | Primary key |
| name | VARCHAR(255) | Required |
| total_jobs | INTEGER | Required |
| pending_jobs | INTEGER | Required |
| failed_jobs | INTEGER | Required |
| failed_job_ids | LONGTEXT | Required |
| options | MEDIUMTEXT | Nullable |
| cancelled_at | INTEGER | Nullable |
| created_at | INTEGER | Required |
| finished_at | INTEGER | Nullable |
failed_jobs
| Column | Type | Attributes |
|---|---|---|
| id | BIGINT UNSIGNED | Primary key |
| uuid | VARCHAR(255) | Unique |
| connection | TEXT | Required |
| queue | TEXT | Required |
| payload | LONGTEXT | Required |
| exception | LONGTEXT | Required |
| failed_at | TIMESTAMP | Default: now |
Personal Access Tokens Table
File:database/migrations/2026_02_06_051602_create_personal_access_tokens_table.php
For Laravel Sanctum token authentication.
| Column | Type | Attributes |
|---|---|---|
| id | BIGINT UNSIGNED | Primary key |
| tokenable_type | VARCHAR(255) | Polymorphic |
| tokenable_id | BIGINT UNSIGNED | Polymorphic |
| name | TEXT | Required |
| token | VARCHAR(64) | Unique |
| abilities | TEXT | Nullable |
| last_used_at | TIMESTAMP | Nullable |
| expires_at | TIMESTAMP | Nullable, indexed |
| created_at | TIMESTAMP | Auto |
| updated_at | TIMESTAMP | Auto |
Models
User Model
File:app/Models/User.php
-
Traits:
HasFactory- Enables model factoriesNotifiable- Enables notifications (email verification, password reset)
-
Mass Assignment:
name,email,passwordcan be mass assigned
-
Hidden Attributes:
passwordandremember_tokenare hidden from JSON serialization
-
Attribute Casting:
email_verified_atcast to datetimepasswordautomatically hashed
Factories
UserFactory
File:database/factories/UserFactory.php
Seeders
DatabaseSeeder
File:database/seeders/DatabaseSeeder.php
Database Configuration
Multiple Database Support
Laravel supports MySQL, PostgreSQL, SQLite, and SQL Server. MySQL (Default):.env
.env
.env
Creating Custom Migrations
Generate Migration
Migration Structure
Next Steps
Controllers
Learn about controller implementation
Testing
Write tests for your database