PHPackages                             fr3on/laravel-forecast - 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. fr3on/laravel-forecast

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

fr3on/laravel-forecast
======================

Preview pending migration impact — row counts, lock estimates, and risk ratings — before you run migrate.

0.0.1(2mo ago)1239MITPHPPHP ^8.2CI passing

Since Apr 10Pushed 2mo agoCompare

[ Source](https://github.com/fr3on/laravel-forecast)[ Packagist](https://packagist.org/packages/fr3on/laravel-forecast)[ Docs](https://github.com/fr3on/laravel-forecast)[ RSS](/packages/fr3on-laravel-forecast/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (7)Versions (2)Used By (0)

Laravel Forecast
================

[](#laravel-forecast)

[![GitHub Tests Action Status](https://camo.githubusercontent.com/f38f74ffce40de0defe233f2fe693bb98b37c572aacd91ba7ad6aeb7c34e3203/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6672336f6e2f6c61726176656c2d666f7265636173742f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/fr3on/laravel-forecast/actions/workflows/tests.yml)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/dfe3aa36a330a2261f95163091cda0794d8758bb4f5392a1b7edf49d36571121/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6672336f6e2f6c61726176656c2d666f7265636173742f70696e742e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/fr3on/laravel-forecast/actions/workflows/pint.yml)[![PHP Version](https://camo.githubusercontent.com/bc858ffdb83bc2ef186f3f675d24c8d5a9b5a3136a023516d71142ddcc691721/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d3737376262342e7376673f7374796c653d666c61742d737175617265266c6f676f3d706870)](https://packagist.org/packages/fr3on/laravel-forecast)[![Laravel Version](https://camo.githubusercontent.com/9e9ced5f934e2d53319e410532e182dd7c596eecfbda43e1a868c16d397cd04c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25354531302e3025323025374325323025354531312e3025323025374325323025354531322e302d6666326432302e7376673f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c)](https://packagist.org/packages/fr3on/laravel-forecast)[![License](https://camo.githubusercontent.com/50098617e883753e0930abd54440d0ac9118cdf5b378691545676df11cd15fa1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d3432386637652e7376673f7374796c653d666c61742d737175617265)](https://github.com/fr3on/laravel-forecast/blob/main/LICENSE)

> `php artisan migrate:forecast` — see exactly what your pending migrations will do, how many rows are at risk, and how long the table lock might last, **before** you type `migrate`.

---

The problem
-----------

[](#the-problem)

`migrate --pretend` gives you raw SQL. The confirmation prompt gives you nothing. Neither tells you:

- *"This ALTER TABLE touches a 12M-row table — expect ~8 minutes of locking"*
- *"This DROP COLUMN still has data in 4,200 rows"*
- *"This NOT NULL column has no DEFAULT — it will fail on existing rows"*

Teams find this out the hard way, mid-deploy, at 2am.

---

Installation
------------

[](#installation)

```
composer require fr3on/laravel-forecast
```

The service provider is auto-discovered. No configuration is required to start.

Optionally publish the config:

```
php artisan vendor:publish --tag=forecast-config
```

---

Usage
-----

[](#usage)

```
php artisan migrate:forecast
```

**Example output:**

```
  Laravel Forecast  |  3 pending migrations

  2024_08_01_add_status_to_orders
  ┌──────────────────────────────────────┬─────────┬──────────┬──────────────────┐
  │ Operation                            │ Risk    │ Rows     │ Est. lock        │
  ├──────────────────────────────────────┼─────────┼──────────┼──────────────────┤
  │ ADD COLUMN orders                    │ SAFE    │ 4.2M     │ < 1s (online)    │
  └──────────────────────────────────────┴─────────┴──────────┴──────────────────┘

  2024_08_02_drop_legacy_payments_table
  ┌──────────────────────────────────────┬─────────┬──────────┬──────────────────┐
  │ Operation                            │ Risk    │ Rows     │ Est. lock        │
  ├──────────────────────────────────────┼─────────┼──────────┼──────────────────┤
  │ DROP TABLE legacy_payments           │ DANGER  │ 38,441   │ instant          │
  └──────────────────────────────────────┴─────────┴──────────┴──────────────────┘
  ⚠  Entire table and all its data will be permanently deleted.
  ⚠  38,441 rows will be permanently deleted.

  2024_08_03_index_orders_user_id
  ┌──────────────────────────────────────┬─────────┬──────────┬──────────────────┐
  │ Operation                            │ Risk    │ Rows     │ Est. lock        │
  ├──────────────────────────────────────┼─────────┼──────────┼──────────────────┤
  │ CREATE INDEX orders                  │ CAUTION │ 4.2M     │ ~42s (estimated) │
  └──────────────────────────────────────┴─────────┴──────────┴──────────────────┘
  ℹ  May lock the table during index creation on older engines.
     Consider ALGORITHM=INPLACE, LOCK=NONE for zero-downtime.

  SAFE: 1   CAUTION: 1   DANGER: 1
  Run with --ci to exit code 1 on any DANGER operation.

```

---

### CI / CD integration

[](#ci--cd-integration)

```
php artisan migrate:forecast --ci
# exits 1 if any DANGER operation is detected — blocks the pipeline automatically
```

---

How it works
------------

[](#how-it-works)

1. **Collects pending migrations** — reads the migrations repository to find which files haven't been run yet.
2. **Captures SQL without executing** — uses Laravel's built-in `connection->pretend()` to get the exact SQL each migration would run.
3. **Classifies each statement** — regex-based SQL analysis extracts the operation type and table name.
4. **Queries row counts** — runs `SELECT COUNT(*) FROM ` against your live database.
5. **Estimates lock time** — applies heuristics based on operation type and row count.

No AST parsing. No reflection hacks. Just SQL string analysis + a `COUNT` query.

---

Risk classification
-------------------

[](#risk-classification)

OperationRiskReason`CREATE TABLE`, `ADD COLUMN` with `DEFAULT` or nullable**SAFE**Additive; online DDL on MySQL 8+`ADD COLUMN NOT NULL` without `DEFAULT`**DANGER**Will fail on non-empty tables`DROP TABLE`, `DROP COLUMN`**DANGER**Irreversible data loss`CREATE INDEX`**CAUTION**May lock table depending on engine version`RENAME COLUMN` / `RENAME TABLE`**CAUTION**May break queries and views`ALTER COLUMN` (type/constraint change)**CAUTION**Risk of data truncation`NOT NULL` constraint on existing column**DANGER**Fails if any row contains NULL---

Configuration
-------------

[](#configuration)

After publishing `config/forecast.php` you can tune:

```
return [
    // Row count above which extra warnings are shown
    'large_table_threshold'  => env('FORECAST_LARGE_TABLE_THRESHOLD', 1_000_000),
    'medium_table_threshold' => env('FORECAST_MEDIUM_TABLE_THRESHOLD', 100_000),

    // Lock-time heuristics (milliseconds per 1,000 rows)
    'ms_per_thousand_rows' => [
        'drop_column'  => 10,
        'create_index' => 10,
        'alter_column' => 15,
        'add_column'   => 5,
    ],

    // Extra migration paths to scan (in addition to database/migrations)
    'migration_paths' => [],
];
```

---

What it is NOT
--------------

[](#what-it-is-not)

- Not a replacement for `migrate` — it only informs before you commit.
- Not `migrate --pretend` — that shows SQL; this shows *impact*.
- Not `enlightn` — that checks code security; this checks schema risk.
- No SaaS, no agents, no database tables. Install and run immediately.

---

License
-------

[](#license)

MIT

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance85

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

77d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/205356416?v=4)[fr3onv](/maintainers/fr3onv)[@fr3onv](https://github.com/fr3onv)

---

Top Contributors

[![fr3on](https://avatars.githubusercontent.com/u/26393383?v=4)](https://github.com/fr3on "fr3on (13 commits)")

---

Tags

analysisartisandatabaseforecastfr3onlaravelmigrationsphpriskschemalaravelschemadatabaseartisanmigrations

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/fr3on-laravel-forecast/health.svg)

```
[![Health](https://phpackages.com/badges/fr3on-laravel-forecast/health.svg)](https://phpackages.com/packages/fr3on-laravel-forecast)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

9782.1M162](/packages/laravel-ai)[illuminate/queue

The Illuminate Queue package.

20432.2M1.5k](/packages/illuminate-queue)[itpathsolutions/dbstan

Database Standardization and Analysis Tool for Laravel

442.1k](/packages/itpathsolutions-dbstan)[orptech/laravel-migration-partition

Laravel extensions that extends Illuminate to enable partitioned table creation within Laravel migrations.

3628.3k](/packages/orptech-laravel-migration-partition)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3159.7k2](/packages/toponepercent-baum)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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