php artisan run migration code example

Example 1: how to migrate single table in laravel

php artisan migrate --path=/database/migrations/2020_04_10_130703_create_test_table.php

Example 2: php artisan make migration

php artisan make:migration create_users_table

Example 3: php artisan run migration

php artisan migrate

Example 4: laravel migration rollback

To rollback one step:

php artisan migrate:rollback

To rollback multiple steps:

php artisan migrate:rollback --step=[x]
  
To drop all tables and reload all migrations:

php artisan migrate:fresh

Example 5: fresh migrqte laravel

$ php artisan migrate:fresh

Dropped all tables successfully.
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table

Example 6: laravel make migration

php artisan make:migration CreateUsersTable

Tags:

Misc Example