PHPackages                             caloskao/migrate-specific - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. caloskao/migrate-specific

ActiveLibrary[Database &amp; ORM](/categories/database)

caloskao/migrate-specific
=========================

Easily perform database migrations of specific migration files in the Laravel framework.

v2.0.1(4y ago)715.5k1MITPHP

Since Sep 20Pushed 4y ago2 watchersCompare

[ Source](https://github.com/caloskao/migrate-specific)[ Packagist](https://packagist.org/packages/caloskao/migrate-specific)[ RSS](/packages/caloskao-migrate-specific/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (1)Versions (15)Used By (0)

MigrateSpecific
===============

[](#migratespecific)

[![GitHub version](https://camo.githubusercontent.com/e0581c889b02520031130fd35e14d6f43c98730508285638afa0175aa148e517/68747470733a2f2f62616467652e667572792e696f2f67682f63616c6f736b616f2532466d6967726174652d73706563696669632e737667)](https://badge.fury.io/gh/caloskao%2Fmigrate-specific)[![Latest Version on Packagist](https://camo.githubusercontent.com/4b6e4348c3018d7f3c14acb58618b0c703a784e44536662ba9937ef9ab18a5be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63616c6f736b616f2f6d6967726174652d73706563696669632e737667)](https://packagist.org/packages/caloskao/migrate-specific)[![GitHub issues](https://camo.githubusercontent.com/ef41c603f0fefafab442a6da374783491d602e39e0a737fe67d6d86ae4b54457/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f63616c6f736b616f2f6d6967726174652d73706563696669632e737667)](https://github.com/caloskao/migrate-specific/issues)[![GitHub license](https://camo.githubusercontent.com/69e3d07f15d2d6fca9700d9c6dab4239bc8a5099aa64f4a9391c79fb4cd02ec5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f63616c6f736b616f2f6d6967726174652d73706563696669632e737667)](https://github.com/caloskao/migrate-specific/blob/master/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/596fa8fcd9c1497a06e80d8e3ebff43b990eb5ddc4e138b82d03a3f2708fe633/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63616c6f736b616f2f6d6967726174652d73706563696669632e737667)](https://packagist.org/packages/caloskao/migrate-specific)

MigrateSpecific is a Laravel framework CLI extension command that helps you easily perform database migrations of specific migration files.

Requirement
===========

[](#requirement)

laravel/framework v5.7 or later.

Installation
============

[](#installation)

Using [composer](https://getcomposer.org/) to install, run this command in your project root directory:

```
composer require caloskao/migrate-specific

```

Now, run `php artisan` , you can see `migrate:specific` in the migrate section:

```
 migrate
  migrate:fresh        Drop all tables and re-run all migrations
  migrate:install      Create the migration repository
  migrate:refresh      Reset and re-run all migrations
  migrate:rollback     Rollback the last database migration
  migrate:specific     Migrate, refresh, reset or rollback for specific migration files.
  migrate:status       Show the status of each migration

```

Upgrade from version 1.x
========================

[](#upgrade-from-version-1x)

In version 1.x, you may have already registered the command at `app / Console / Kernel.php`:

```
protected $commands = [
    \CalosKao\MigrateSpecific::class
];

```

MigrateSpecific uses [laravel package discovery](https://laravel.com/docs/5.8/packages#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.

```
protected $commands = [
    \CalosKao\MigrateSpecific::class // remove this line.
];

```

Usage
=====

[](#usage)

You can run `php artisan help migrate:specific` to check command usage:

```
Description:
  Migrate, rollback or refresh for specific migration files.

Usage:
  migrate:specific [options] [--] [...]

Arguments:
  files                          File or directory path, support multiple file (Sperate by space)  [default: "database/migrations"]

Options:
  -p, --pretend                  Dump the SQL queries that would be run
  -f, --skip-foreign-key-checks  Set FOREIGN_KEY_CHECKS=0 before migrate
  -k, --keep-batch               Keep batch number. (Only works in refresh mode)
  -m, --mode[=MODE]              Set migrate execution mode, supported mode have: default, rollback, refresh [default: "default"]
  -y, --assume-yes               Automatically assumes "yes" to run commands in non-interactive mode. This option is automatically enabled if you use the option "-n" or "-q"
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --env[=ENV]                The environment the command should run under
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

```

Examples
========

[](#examples)

Migrate single file or directory:
---------------------------------

[](#migrate-single-file-or-directory)

```
php artisan migrate:specific

```

Migrate mutiple migrations on different paths:
----------------------------------------------

[](#migrate-mutiple-migrations-on-different-paths)

```
php artisan migrate:specific    ...

```

Output is like below:

```
The following migration files will be migrated:
  2014_10_12_000000_create_users_table.php
  2018_07_31_174401_create_jobs_table.php
  2018_07_31_185911_create_failed_jobs_table.php

 Is this correct? (yes/no) [no]:
 > yes

Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table
Migrating: 2018_07_31_174401_create_jobs_table
Migrated:  2018_07_31_174401_create_jobs_table
Migrating: 2018_07_31_185911_create_failed_jobs_table
Migrated:  2018_07_31_185911_create_failed_jobs_table

```

Migrate mode
============

[](#migrate-mode)

Use option `-m` or `--mode` to run `migrate:refresh` or `migrate:rollback` for specific migrations.

```
# Rollback mode
php artisan migrate:specific -m rollback

# Refresh mode
php artisan migrate:specific -m refresh

```

Keep batch number in refresh mode
=================================

[](#keep-batch-number-in-refresh-mode)

Use option `-k` or `--keep-batch` to keep migration batch.

Before migrate:

Ran?MigrationBatchYes2019\_02\_14\_011711\_create\_password\_resets\_table1Yes2019\_02\_14\_011711\_create\_users\_table2```
php artisan migrate:specific -m refresh -k database/migrations/2019_02_14_011711_create_password_resets_table.php

```

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
=======================

[](#skip-foreign-key-checks)

If your pattern has foreign key constraints, sometimes you might get errors, for example on MySQL or MariaDB:

```
Rolling back: 2019_02_14_011711_create_users_table
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (SQL: drop table `users`)

```

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.

```
Rolling back: 2019_02_14_011711_create_users_table
SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP FOREIGN KEY `fk_projects_users_1`; check that it exists (SQL: alter table `reports` drop foreign key `fk_projects_users_1`)

```

Skip confirmation
=================

[](#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.

```
php artisan migrate:specific -y

```

**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
=======

[](#license)

The MigrateSpecific extension is open-sourced software licensed under the MIT license.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~114 days

Recently: every ~307 days

Total

13

Last Release

1464d ago

Major Versions

v1.3.2 → v2.0.0-beta.12019-02-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/fdd1efbbf897617ff2608b1d9443ea436c82fd9ac5250eb2905475b7cc704395?d=identicon)[caloskao](/maintainers/caloskao)

---

Top Contributors

[![caloskao](https://avatars.githubusercontent.com/u/2961077?v=4)](https://github.com/caloskao "caloskao (36 commits)")

---

Tags

artisandatabase-migrationslaravelmigratephplaraveldatabasemysqlmariadbeloquentartisanmigrate

### Embed Badge

![Health badge](/badges/caloskao-migrate-specific/health.svg)

```
[![Health](https://phpackages.com/badges/caloskao-migrate-specific/health.svg)](https://phpackages.com/packages/caloskao-migrate-specific)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11223.5M33](/packages/anourvalar-eloquent-serialize)[waad/laravel-model-metadata

A robust Laravel package for handling metadata with JSON casting, custom relation names, and advanced querying capabilities.

854.6k](/packages/waad-laravel-model-metadata)[ramadan/easy-model

A Laravel package for enjoyably managing database queries.

111.6k](/packages/ramadan-easy-model)[mozex/laravel-scout-bulk-actions

Import, flush, and queue-import all your Laravel Scout searchable models at once. Auto-discovers models, runs in bulk, tracks progress.

1539.3k](/packages/mozex-laravel-scout-bulk-actions)[wayofdev/laravel-cycle-orm-adapter

🔥 A Laravel adapter for CycleORM, providing seamless integration of the Cycle DataMapper ORM for advanced database handling and object mapping in PHP applications.

3535.8k3](/packages/wayofdev-laravel-cycle-orm-adapter)[boaideas/laravel-cli-create-user

An artisan command to create, list and remove users in a laravel application from the cli

1710.7k](/packages/boaideas-laravel-cli-create-user)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
