{"id":29119510,"url":"https://github.com/caloskao/migrate-specific","last_synced_at":"2025-06-29T14:02:21.949Z","repository":{"id":54960371,"uuid":"149582544","full_name":"caloskao/migrate-specific","owner":"caloskao","description":"The Laravel framework artisan CLI extension command. Easily perform database migrations of specific migration files.","archived":false,"fork":false,"pushed_at":"2022-06-30T08:25:13.000Z","size":36,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-27T11:06:45.824Z","etag":null,"topics":["artisan","database-migrations","laravel","migrate","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caloskao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-20T09:11:10.000Z","updated_at":"2024-12-25T21:55:46.000Z","dependencies_parsed_at":"2022-08-14T07:30:45.324Z","dependency_job_id":null,"html_url":"https://github.com/caloskao/migrate-specific","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/caloskao/migrate-specific","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caloskao%2Fmigrate-specific","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caloskao%2Fmigrate-specific/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caloskao%2Fmigrate-specific/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caloskao%2Fmigrate-specific/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caloskao","download_url":"https://codeload.github.com/caloskao/migrate-specific/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caloskao%2Fmigrate-specific/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262412155,"owners_count":23306869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artisan","database-migrations","laravel","migrate","php"],"created_at":"2025-06-29T14:01:20.584Z","updated_at":"2025-06-29T14:02:21.926Z","avatar_url":"https://github.com/caloskao.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MigrateSpecific\n\n[![GitHub version](https://badge.fury.io/gh/caloskao%2Fmigrate-specific.svg)](https://badge.fury.io/gh/caloskao%2Fmigrate-specific)\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/caloskao/migrate-specific.svg)](https://packagist.org/packages/caloskao/migrate-specific)\n[![GitHub issues](https://img.shields.io/github/issues/caloskao/migrate-specific.svg)](https://github.com/caloskao/migrate-specific/issues)\n[![GitHub license](https://img.shields.io/github/license/caloskao/migrate-specific.svg)](https://github.com/caloskao/migrate-specific/blob/master/LICENSE)\n[![Total Downloads](https://img.shields.io/packagist/dt/caloskao/migrate-specific.svg)](https://packagist.org/packages/caloskao/migrate-specific)\n\nMigrateSpecific is a Laravel framework CLI extension command that helps you easily perform database migrations of specific migration files.\n\n# Requirement\n\nlaravel/framework v5.7 or later.\n\n# Installation\n\nUsing [composer](https://getcomposer.org/) to install, run this command in your project root directory:\n\n```\ncomposer require caloskao/migrate-specific\n```\n\nNow, run `php artisan` , you can see `migrate:specific` in the migrate section:\n\n```\n migrate\n  migrate:fresh        Drop all tables and re-run all migrations\n  migrate:install      Create the migration repository\n  migrate:refresh      Reset and re-run all migrations\n  migrate:rollback     Rollback the last database migration\n  migrate:specific     Migrate, refresh, reset or rollback for specific migration files.\n  migrate:status       Show the status of each migration\n```\n\n# Upgrade from version 1.x\n\nIn version 1.x, you may have already registered the command at `app / Console / Kernel.php`:\n\n```\nprotected $commands = [\n    \\CalosKao\\MigrateSpecific::class\n];\n```\n\nMigrateSpecific 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.\n\nTo fix this, just remove the class register.\n\n```\nprotected $commands = [\n    \\CalosKao\\MigrateSpecific::class // remove this line.\n];\n```\n\n# Usage\n\nYou can run `php artisan help migrate:specific` to check command usage:\n\n```\nDescription:\n  Migrate, rollback or refresh for specific migration files.\n\nUsage:\n  migrate:specific [options] [--] [\u003cfiles\u003e...]\n\nArguments:\n  files                          File or directory path, support multiple file (Sperate by space)  [default: \"database/migrations\"]\n\nOptions:\n  -p, --pretend                  Dump the SQL queries that would be run\n  -f, --skip-foreign-key-checks  Set FOREIGN_KEY_CHECKS=0 before migrate\n  -k, --keep-batch               Keep batch number. (Only works in refresh mode)\n  -m, --mode[=MODE]              Set migrate execution mode, supported mode have: default, rollback, refresh [default: \"default\"]\n  -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\"\n  -h, --help                     Display this help message\n  -q, --quiet                    Do not output any message\n  -V, --version                  Display this application version\n      --ansi                     Force ANSI output\n      --no-ansi                  Disable ANSI output\n  -n, --no-interaction           Do not ask any interactive question\n      --env[=ENV]                The environment the command should run under\n  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\n```\n\n# Examples\n\n## Migrate single file or directory:\n\n```\nphp artisan migrate:specific \u003cpath\u003e\n```\n\n## Migrate mutiple migrations on different paths:\n\n```\nphp artisan migrate:specific \u003cpath 1\u003e \u003cpath 2\u003e \u003cpath 3\u003e ...\n```\n\nOutput is like below:\n\n```\nThe following migration files will be migrated:\n  2014_10_12_000000_create_users_table.php\n  2018_07_31_174401_create_jobs_table.php\n  2018_07_31_185911_create_failed_jobs_table.php\n\n Is this correct? (yes/no) [no]:\n \u003e yes\n\nMigrating: 2014_10_12_000000_create_users_table\nMigrated:  2014_10_12_000000_create_users_table\nMigrating: 2018_07_31_174401_create_jobs_table\nMigrated:  2018_07_31_174401_create_jobs_table\nMigrating: 2018_07_31_185911_create_failed_jobs_table\nMigrated:  2018_07_31_185911_create_failed_jobs_table\n```\n\n# Migrate mode\n\nUse option `-m` or `--mode` to run `migrate:refresh` or `migrate:rollback` for specific migrations.\n\n```\n# Rollback mode\nphp artisan migrate:specific -m rollback \u003cpath\u003e\n\n# Refresh mode\nphp artisan migrate:specific -m refresh \u003cpath\u003e\n```\n\n# Keep batch number in refresh mode\n\nUse option `-k` or `--keep-batch` to keep migration batch.\n\nBefore migrate:\n\n| Ran?  | Migration                                      | Batch |\n|:-----:|------------------------------------------------|:-----:|\n| Yes   | 2019_02_14_011711_create_password_resets_table | 1     |\n| Yes   | 2019_02_14_011711_create_users_table           | 2     |\n\n```\nphp artisan migrate:specific -m refresh -k database/migrations/2019_02_14_011711_create_password_resets_table.php\n```\n\nRun `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.\n\n# Skip foreign key checks\n\nIf your pattern has foreign key constraints, sometimes you might get errors, for example on MySQL or MariaDB:\n\n```\nRolling back: 2019_02_14_011711_create_users_table\nSQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (SQL: drop table `users`)\n```\n\nUse option `-f` of `--skip-foreign-key-checks` to execute database statement `SET FOREIGN_KEY_CHECKS=0` before migrate.\n\n**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.\n\n```\nRolling back: 2019_02_14_011711_create_users_table\nSQLSTATE[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`)\n```\n\n# Skip confirmation\n\nSometimes 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.\n\n```\nphp artisan migrate:specific -y \u003cpath\u003e\n```\n\n**Note:**\n\n- If you call the option `-n` or `-q`, MigrateSpecific will be automatically skip confirmation.\n- **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.**\n\n# License\n\nThe MigrateSpecific extension is open-sourced software licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaloskao%2Fmigrate-specific","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaloskao%2Fmigrate-specific","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaloskao%2Fmigrate-specific/lists"}