Download the PHP package caloskao/migrate-specific without Composer
On this page you can find all versions of the php package caloskao/migrate-specific. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package migrate-specific
MigrateSpecific
MigrateSpecific is a Laravel framework CLI extension command that helps you easily perform database migrations of specific migration files.
Requirement
laravel/framework v5.7 or later.
Installation
Using composer to install, run this command in your project root directory:
Now, run php artisan
, you can see migrate:specific
in the migrate section:
Upgrade from version 1.x
In version 1.x, you may have already registered the command at app / Console / Kernel.php
:
MigrateSpecific uses laravel package discovery to automatically load commands after version 2.0, so you don't need to manually register the commands, but if you have manual registration, you may encounter a class not found exception when you run the application.
To fix this, just remove the class register.
Usage
You can run php artisan help migrate:specific
to check command usage:
Examples
Migrate single file or directory:
Migrate mutiple migrations on different paths:
Output is like below:
Migrate mode
Use option -m
or --mode
to run migrate:refresh
or migrate:rollback
for specific migrations.
Keep batch number in refresh mode
Use option -k
or --keep-batch
to keep migration batch.
Before migrate:
Ran? | Migration | Batch |
---|---|---|
Yes | 2019_02_14_011711_create_password_resets_table | 1 |
Yes | 2019_02_14_011711_create_users_table | 2 |
Run php artisan migrate:status
after migrate, you can see the migration 2019_02_14_011711_create_password_resets_table
batch number will not be changed.
Skip foreign key checks
If your pattern has foreign key constraints, sometimes you might get errors, for example on MySQL or MariaDB:
Use option -f
of --skip-foreign-key-checks
to execute database statement SET FOREIGN_KEY_CHECKS=0
before migrate.
Note: A good practice is to rollback related foreign key migration at the same time, otherwise you may still get other errors, such as SQL Error 1091.
Skip confirmation
Sometimes we need to perform a database migration many times, or we need to deploy it into an automated process. At this time, we can use the option -y
to directly perform database migration without confirmation.
Note:
- If you call the option
-n
or-q
, MigrateSpecific will be automatically skip confirmation. - If you are not working in the above situations, we recommend that you do not perform a database migration in non-interactive mode to avoid accidental data loss.
License
The MigrateSpecific extension is open-sourced software licensed under the MIT license.