Mahmoud Ramadan

Custom Fresh - Create exceptions for tables that do not need to be dropped

by•
This release adds `--database`, `--keep`, and `--explain` options, publishable configuration support, lifecycle events, glob-pattern table retention, and safer migration handling. It also fixes migration discovery, improves alter migration detection, avoids unnecessary database bootstrapping on every Artisan call, and greatly improves overall reliability and performance. 💥

Add a comment

Replies

Best
Mahmoud Ramadan
Maker
📌

🚀 New Custom Fresh Release

This release introduces safer database refresh workflows, improved migration handling, lifecycle events, configurable retention rules, and major internal stability improvements.

✨ Added

  • Added the --database= option and forwards it directly to the underlying migrate command.

  • Added the --keep= flag as an alias for the positional argument with glob pattern support, like:

    • oauth_*

    • cache_*

  • Added the --explain dry-run mode to preview actions without modifying the database.

  • Added a publishable custom-fresh.php configuration file supporting:

    • always_keep

    • patterns

    • confirm_in

  • Added lifecycle events:

    • RefreshingDatabase

    • TablesDropped

    • DatabaseRefreshed

  • Wrapped migrations table resets inside a foreign-key-disabled block for safer execution.

  • Replaced substr() usage with pathinfo() for more reliable migration name extraction.

  • Updated command responses to use:

    • Command::SUCCESS

    • Command::FAILURE

  • Improved and clarified the command argument descriptions.

🛠 Fixed

  • Deferred database and filesystem bootstrapping from __construct() to handle() so the package no longer connects to the database during every Artisan command execution.

  • Fixed migration discovery by replacing fragile filename heuristics with real Schema::* parsing.

  • Improved alter migration detection to capture all matching migrations correctly.

  • Added support for scanning nested and registered migration paths during migration discovery.

💚 This release makes Custom Fresh safer, more configurable, and significantly more reliable for complex Laravel database workflows.