{"id":14973953,"url":"https://github.com/mahmoudmohamedramadan/custom-fresh","last_synced_at":"2026-06-06T01:01:11.045Z","repository":{"id":50023118,"uuid":"494900934","full_name":"mahmoudmohamedramadan/custom-fresh","owner":"mahmoudmohamedramadan","description":"A Laravel package to specify the tables that you do not want to drop while refreshing the database.","archived":false,"fork":false,"pushed_at":"2025-02-27T22:54:48.000Z","size":284,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"1.x","last_synced_at":"2025-10-03T07:39:38.268Z","etag":null,"topics":["composer","custom-fresh","custom-migrate","laravel","mariadb","migrations","mssql","mysql","oracle","pdo","pgsql","php","postgresql","queryobject","sql","sqlite","sqlserver"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mahmoudmohamedramadan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["mahmoudmohamedramadan"],"patreon":"mmramadan496","buy_me_a_coffee":"mmramadan496","custom":["https://www.paypal.com/paypalme/mmramadan496"]}},"created_at":"2022-05-21T21:42:10.000Z","updated_at":"2025-02-27T22:49:02.000Z","dependencies_parsed_at":"2024-10-22T15:25:52.826Z","dependency_job_id":null,"html_url":"https://github.com/mahmoudmohamedramadan/custom-fresh","commit_stats":{"total_commits":48,"total_committers":2,"mean_commits":24.0,"dds":"0.22916666666666663","last_synced_commit":"db473ec2662b32b7db360c8352052c1ddfd20d0e"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/mahmoudmohamedramadan/custom-fresh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmoudmohamedramadan%2Fcustom-fresh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmoudmohamedramadan%2Fcustom-fresh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmoudmohamedramadan%2Fcustom-fresh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmoudmohamedramadan%2Fcustom-fresh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mahmoudmohamedramadan","download_url":"https://codeload.github.com/mahmoudmohamedramadan/custom-fresh/tar.gz/refs/heads/1.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmoudmohamedramadan%2Fcustom-fresh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014804,"owners_count":26085594,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["composer","custom-fresh","custom-migrate","laravel","mariadb","migrations","mssql","mysql","oracle","pdo","pgsql","php","postgresql","queryobject","sql","sqlite","sqlserver"],"created_at":"2024-09-24T13:49:43.983Z","updated_at":"2026-06-06T01:01:11.031Z","avatar_url":"https://github.com/mahmoudmohamedramadan.png","language":"PHP","funding_links":["https://github.com/sponsors/mahmoudmohamedramadan","https://patreon.com/mmramadan496","https://buymeacoffee.com/mmramadan496","https://www.paypal.com/paypalme/mmramadan496","https://paypal.com/paypalme/mmramadan496"],"categories":[],"sub_categories":[],"readme":"# Custom Fresh\n\n![Custom Fresh](/art/logo.png \"Custom Fresh\")\n\n![Latest Version](https://img.shields.io/packagist/v/ramadan/custom-fresh?style=flat-square\u0026logo=packagist)\n![Total Downloads](https://img.shields.io/packagist/dt/ramadan/custom-fresh?style=flat-square)\n![PHP](https://img.shields.io/badge/php-%5E8.2-777BB4?logo=php\u0026style=flat-square)\n![Laravel](https://img.shields.io/badge/laravel-%5E10.0%7C%5E11.0%7C%5E12.0%7C%5E13.0-FF2D20?logo=laravel\u0026style=flat-square)\n![License](https://img.shields.io/packagist/l/ramadan/custom-fresh?style=flat-square)\n\n - - -\n\nCustom Fresh offers fine-grained control over migrations within your Laravel project, enabling you to select which tables will not be dropped when refreshing the database.\n\n\u003e [!TIP]\n\u003e Always consider upgrading the package to the [latest](https://github.com/mahmoudmohamedramadan/custom-fresh/releases/latest) version, which is the most stable release.\n\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Refreshing migrations](#refreshing-migrations)\n  - [Glob patterns](#glob-patterns)\n  - [Multiple connections](#multiple-connections)\n  - [Dry run](#dry-run)\n  - [Configuration](#configuration)\n  - [Events](#events)\n  - [Example](#example)\n- [Credits](#credits)\n- [Support me](#support-me)\n\n## Installation\n\nInstall the package by using [Composer](https://getcomposer.org/):\n\n```SHELL\ncomposer require ramadan/custom-fresh\n```\n\n(Optional) publish the config file:\n\n```SHELL\nphp artisan vendor:publish --tag=custom-fresh-config\n```\n\n## Usage\n\nAfter installing the package, you will see a new `fresh:custom` command.\n\n\u003e [!NOTE]\n\u003e Since `v1.2.0`, the package scans your migration files more accurately,\n\u003e including nested folders, custom `--path` locations, and package\n\u003e migration paths registered through Laravel.\n\n### Refreshing migrations\n\nYou can exclude specific tables while refreshing the database inside your project:\n\n```SHELL\nphp artisan fresh:custom users,foo\n```\n\nThe same can be expressed with the `--keep` option (which can be combined with the positional argument):\n\n```SHELL\nphp artisan fresh:custom --keep=users,personal_access_tokens\n```\n\n\u003e [!IMPORTANT]\n\u003e Do not forget always to use the `-h` of the command to check out all supported options.\n\n### Glob patterns\n\nAnything containing `*`, `?`, or `[…]` is expanded with `fnmatch` against the database tables, so you can preserve whole groups at once:\n\n```SHELL\nphp artisan fresh:custom \"users,oauth_*,telescope_*\"\n```\n\n### Multiple connections\n\nPass `--database=` to target a non-default connection. The connection is also forwarded to the `migrate` command:\n\n```SHELL\nphp artisan fresh:custom users --database=tenant\n```\n\n### Dry run\n\nUse `--explain` to preview exactly what would happen without dropping a single table:\n\n```SHELL\nphp artisan fresh:custom users --explain\n```\n\nIt prints the resolved connection, the tables that would be preserved, the tables that would be dropped, and the migration rows that would be re-inserted into the `migrations` table.\n\n### Configuration\n\nPublishing the config (see above) gives you `config/custom-fresh.php`:\n\n```PHP\nreturn [\n    'always_keep' =\u003e ['users', 'personal_access_tokens'],\n    'patterns'    =\u003e ['oauth_*', 'telescope_*'],\n    'confirm_in'  =\u003e ['production', 'staging'],\n];\n```\n\n- **`always_keep`** — tables that are preserved on every run, even if you don't list them on the command line.\n- **`patterns`** — glob patterns expanded against the database on every run.\n- **`confirm_in`** — environments where the command must ask for confirmation. Use `--force` to bypass.\n\n### Events\n\nThree events are dispatched during a run, perfect for backups, audit logs, or Slack notifications:\n\n- `Ramadan\\CustomFresh\\Events\\RefreshingDatabase` — fired before any destructive work, with the resolved preserve list and migration rows.\n- `Ramadan\\CustomFresh\\Events\\TablesDropped` — fired right after the drop step, with both the preserved and dropped tables.\n- `Ramadan\\CustomFresh\\Events\\DatabaseRefreshed` — fired after the underlying `migrate` finishes successfully.\n\n### Example\n\n![Custom Fresh CLI Command Example](/art/screenshot.png)\n\n## Credits\n\n- [Mahmoud Ramadan](https://github.com/mahmoudmohamedramadan)\n- [Contributors](https://github.com/mahmoudmohamedramadan/custom-fresh/graphs/contributors)\n\n## Support me\n\n- [PayPal](https://paypal.com/paypalme/mmramadan496)\n\n## License\n\nThe MIT License (MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahmoudmohamedramadan%2Fcustom-fresh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahmoudmohamedramadan%2Fcustom-fresh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahmoudmohamedramadan%2Fcustom-fresh/lists"}