- How do I install ramadan/custom-fresh in a Laravel application?
- Install it as a dev dependency with composer require --dev ramadan/custom-fresh, then publish the config file with php artisan vendor:publish if the package ships one. Because it is require-dev only, it never enters your production runtime dependency graph. Confirm Laravel package auto-discovery registers the service provider, or add it manually to your providers list.
- How do I configure which tables are excluded from migrate:fresh?
- After publishing the config, add the table names you want preserved to the package's exclusion array. Then swap your usual php artisan migrate:fresh call for the package's command in your Makefile or composer scripts. Check in the config whether the list applies globally or per database connection before relying on it across connections.
- Which Laravel and PHP versions does custom-fresh support?
- That depends on the composer.json constraint and whether a CI test matrix is published, so verify both on the repository rather than assuming. The package hooks into migrate:fresh, whose --drop-views, --drop-types and --seed options have shifted between Laravel 8 and 12. Pin a version and smoke-test on your exact Laravel release before adopting it in a shared workflow.
- Does custom-fresh skip the drop or dump and restore the preserved tables?
- This is the most important question to answer before adopting it, because the two designs behave very differently. Skipping the drop is faster but silently diverges from migrations when a preserved table gains a column, which is the classic works-on-my-machine failure. Dump and restore keeps rows intact but is slower and can clash with seeders. Check the README or ask the maintainer which approach is implemented.
- Which database drivers does custom-fresh support, MySQL, PostgreSQL or SQLite?
- Drivers differ on foreign key ordering, SET FOREIGN_KEY_CHECKS, schema-qualified names and view handling, so coverage matters. SQLite is the default test driver in most Laravel projects and is often untested upstream, so verify it explicitly if you rely on it. Look for a documented support matrix or run your own pilot against each driver you use.
- How does custom-fresh interact with the --seed option of migrate:fresh?
- The interaction depends on ordering: if preserved tables are restored before seeders run, restored data can be overwritten, and if seeders run twice you get double-seeding. Test the combination with a small dataset and inspect the resulting row counts. If the behaviour is undocumented, raise it with the maintainer before putting it in a shared team script.
- Can I use custom-fresh with multiple database connections and schema-qualified table names?
- Verify whether the exclusion list is global or per-connection, since a global list can behave unexpectedly in multi-tenant or multi-database setups. Schema-qualified names such as public.users may need special handling depending on the driver. Run a pilot on a secondary connection before depending on it.
- Is ramadan/custom-fresh safe to use in production?
- It is development and CI tooling, installed with require-dev, so it should never ship to production. The real risk is a typo in the exclusion list, which either drops data you meant to keep or keeps a table you meant to rebuild. Use it only against disposable local or CI databases, and keep backups even there.
- How do I run custom-fresh in CI pipelines or a composer script?
- Wire the package command into your Makefile or composer script in place of migrate:fresh, exactly where your existing database rebuild step runs. Add a test that asserts preserved tables still contain rows and that migrations applied cleanly to the rest. That test is the only thing that will catch a bad exclusion list, since the package itself cannot know your intent.
- What are the alternatives to custom-fresh, and is it actively maintained?
- Alternatives include plain migrate:fresh --seed with fast reference-data seeders, SQL schema dumps, or registering your own db:wipe or post-fresh restore hook. The package has roughly 61 stars, zero dependents and a single maintainer, so there is little ecosystem validation or peer review of the drop-list logic. Check the actual tag history and commit cadence before relying on it long term, and treat the reported last-release date as a data-quality flag to confirm.