konekt/laravel-migration-compatibility
A Laravel package for checking database migration compatibility, helping you catch potential issues before upgrading Laravel or deploying schema changes. Useful for keeping migrations safe and portable across environments.
int/unsignedInteger or bigInt/unsignedBigInteger to match the referenced table's primary key. That decision surfaces whenever migrations must run against schemas from different Laravel eras (pre-5.8 increments vs. post-5.8 bigIncrements). It is small enough that "build" (a helper trait or two methods in our own codebase) is a credible alternative to "buy."errno: 150 foreign-key errors during php artisan migrate.Consider it when:
int primary keys alongside newer bigInt tables, and a single coordinated conversion is not feasible in the near term.Look elsewhere — or skip it — when:
bigInt keys. Laravel's native foreignId()->constrained() and foreignIdFor(Model::class) already handle this, with no extra dependency.bigInt. Fixing the schema once is cheaper than carrying a compatibility layer indefinitely.Adoption gate: treat adoption as conditional on the package remaining small and readable, on the version being pinned and vendored or forked where practical, and on a documented exit path (replace with native foreignIdFor() once the supported-version floor rises).
For executives (one paragraph): This is a small, MIT-licensed utility that prevents a specific and recurring class of database migration failure in Laravel — mismatched integer types on foreign keys, which cause installs and upgrades to fail outright. It is not a platform bet and carries no strategic weight. The signal we have is thin: no stars, no known dependents, a single-maintainer profile. We therefore recommend treating it as reference source rather than a dependency — either vendor the approach into our own package code or adopt it pinned with a fork plan. Cost is negligible; the benefit is fewer migration-related support tickets for anyone installing our packages into older applications.
For engineering (summary):
php artisan migrate failing with foreign-key errors because a user_id column was declared unsignedInteger while users.id is unsignedBigInteger (or the reverse). This became common after Laravel 5.8 changed the default primary key to bigIncrements.foreignIdForTable()-style method, or a check against Schema::getColumnType() / the model's getKeyType() — gives us the same behavior with no third-party risk and no version-pinning overhead.composer.json, note the fork path in the package README, and add a test that installs our package into a fixture app with int keys to keep the compatibility path honest.foreignIdFor() and a documented minimum Laravel version for everything else; reserve this package (or an inlined equivalent) for the genuinely mixed-schema case where the native helpers do not apply.How can I help you explore Laravel packages today?