Skip to content

Migration Commands

Commands to manage tenant migrations.

Runs migrations for a specific tenant.

Terminal window
# Interactive mode
php artisan tenant:migrate
# Specific tenant
php artisan tenant:migrate my-tenant
# With seeders
php artisan tenant:migrate my-tenant --seed
# Force in production
php artisan tenant:migrate my-tenant --force
  • --path=PATH - Specific migration path
  • --force - Force migration in production
  • --seed - Run seeders after migration
  • --step - Force step-by-step migration

Rolls back migrations for a specific tenant.

Terminal window
# Interactive mode
php artisan tenant:rollback
# Rollback last migration
php artisan tenant:rollback my-tenant
# Rollback last 3 migrations
php artisan tenant:rollback my-tenant --step=3
# Rollback to specific batch
php artisan tenant:rollback my-tenant --batch=5
  • --step=N - Number of migrations to rollback
  • --batch=N - Rollback to specific batch
  • --force - Force rollback in production

Drops all tables and re-runs migrations.

Terminal window
# Interactive mode
php artisan tenant:fresh
# Complete reset
php artisan tenant:fresh my-tenant
# With seeders
php artisan tenant:fresh my-tenant --seed
# Force in production
php artisan tenant:fresh my-tenant --force
  • --seed - Run seeders after migration
  • --force - Force operation in production
  • --drop-views - Drop all views
  • --drop-types - Drop custom types (PostgreSQL)