Laravel specific table Migration
Laravel specific table Migration
In this session, we will try our hand at solving the "Laravel specific table Migration".
Migrate a particular table in laravel--PATH /database/migrations/<your_file_name>.php
php artisan migrate --path=/database/migrations/2021_04_09_053158_create_projects_table.php
You can run a migration command to create a migration for a specific file under the database/migrations folder. Change the file name as per your file name instead of
2021_04_09_053158_create_projects_table.phpin my case and after that run migrate command. You table structure will be successfully created after the migrate command.
Create Migrations In Different Folder In Laravel
php artisan migrate:make create_payments_table --path=app/migrations/payments
You can use the same --path option while creating migration and it will easily create the migration in the newly defined path. After running the above command new migration will be created into the app/migrations/payments folder.
Run All Migrations In Different Folder In Laravel
php artisan migrate --path=app/migrations/payments
we have created new migrations in a different folder structure (
database/migrations. You can run all that migrations by using same
php artisan migratecommand.
How do I run a specific migration table?
php artisan migrate --path=/database/migrations/fileName.php.
php artisan migrate:rollback --path=/database/migrations/fileName.php.
php artisan migrate:refresh --path=/database/migrations/fileName.php.
How to Migrate Specific File from Migration in Laravel?
To run the specific migration in Laravel, you need to use –path option with the php artisan migrate command. Let's take a simple example, we have '2019_12_04_131405_create_payments_table. php' migration in the database/migrations directory and we would like to run this migration.
How to migrate single migration in Laravel?
We just need to migrate only single or specific migration. If we run normal migrate command it will migrate all the migrations written in the application. Here i will let you know to migrate single migration in laravel. Now if we want to run only one migration or a specific migration, we will need to define a path parameter and will need to specify the path of that migration file which we want to run. eg:
php artisan migrate --path=/database/migrations/my_migration.php.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Laravel
- How to call controller function from view in Laravel
- Insert data with form validation using ajax in laravel
- Laravel 7 login error message not showing
- How to insert value to additional columns in pivot table in laravel
- Ignore Records where a field has NULL value in Laravel
- Method Illuminate\Events\Dispatcher::fire does not exist
- Laravel insert query not working
- How to Run CRON Job on LIVE SERVER on Cpanel in Laravel Project
- Return redirect laravel not working
- How to get only time from created_at in laravel
- Update last created record in Laravel
- How to create and run user seeder in laravel
- Retain selected value of select box in Laravel
- SQLSTATE: Syntax error or access violation: 1055
- Declaration of App\Models\Post::sluggable() must be compatible with Cviebrock\EloquentSluggable\Sluggable
- How to update record after save method in Laravel
- How to get route name on visit URL in laravel
- How to create laravel project using composer
- Return view from route Laravel
- Create records using relationship in laravel
- Add [name] to fillable property to allow mass assignment on [App\Models\Project]
- Remove several global scope from query
- Ajax POST request in laravel
- Class 'App\Providers\Auth' not found
- If condition in Laravel 9