axn/laravel-pk-int-to-bigint
Safely convert Laravel integer primary keys to bigint with this package's migration helpers and Artisan commands, updating existing ID columns and related foreign keys so your database is ready for large datasets without breaking references.
Architecture fit
The package is a development-time schema tooling utility, not a runtime dependency. It fits cleanly into a Laravel codebase as a require-dev Composer package that generates or executes migrations to widen INT primary keys and their referencing foreign keys to BIGINT. Architecturally it touches the persistence layer only (migrations, schema), with no impact on application code, service providers, or request lifecycle — the lowest-risk integration surface a package of this kind can have. It is best understood as a one-shot remediation tool for legacy schemas built before Laravel defaulted to bigIncrements/id(), not as something you run continuously.
Integration feasibility
Installation and first run are trivial (composer require --dev, artisan command). The real feasibility question is whether the generated migrations are correct for your specific schema. Because FK columns must remain type-identical to the columns they reference (InnoDB enforces this), the tool must drop and recreate every FK in the correct order across all tables — this is where edge cases live: composite keys, polymorphic *_type/*_id morph pairs, pivot tables, and cross-database references. Feasibility is high on a clean, conventional schema; it drops sharply on schemas with hand-rolled DDL, non-Laravel-managed tables, or unusual constraint naming.
Technical risk
INT→BIGINT is lossless by itself, but a partial failure (FK dropped, column altered, FK re-add fails) leaves the schema in an inconsistent, half-migrated state. DDL is non-transactional on MySQL, so there is no automatic rollback.Key questions
BIGINT columns?ALGORITHM=INPLACE/online-DDL tooling (gh-ost, pt-online-schema-change), or is it plain ALTER TABLE?->change(), or the native Laravel 11+ path?Stack fit
Fits any Laravel 8–12 project on MySQL/MariaDB (the common case for the increments() legacy pattern), assuming PHP 8.1+ and 64-bit PHP. It composes with the existing migration system rather than replacing it, and does not alter Eloquent behavior — int columns become bigint, both map to PHP int on 64-bit platforms. Flag the 32-bit PHP edge case: BIGINT values will overflow PHP_INT_MAX and silently degrade to float/string.
Migration path
main until validated.Compatibility
Confirm the schema is fully managed by Laravel migrations before starting — any table created outside the migration system (legacy dump, manual DDL) will likely be missed or broken. Check that no code relies on column width assumptions (e.g., stored procedures, BI extracts, external consumers reading information_schema).
Sequencing Schema inventory → package evaluation/vendoring decision → staging generation and review → production-sized rehearsal → stakeholder sign-off and window scheduling → execute → verify → document new schema baseline. The package itself is step 2–3; the surrounding process is where the TPM's effort concentrates.
Maintenance MIT-licensed and low-activity. Do not take a long-term runtime dependency on it: run it, then remove it. If the schema requires repeated remediation across environments, fork and vendor the migrations under your own control rather than pinning to an unmaintained package.
Support No vendor SLA. Support is GitHub issues from a single maintainer. Escalation path is "read the source and patch it yourself" — acceptable for a one-shot dev tool, unacceptable if treated as infrastructure.
Scaling
This is precisely the scaling fix: it removes the ~2.1B-row signed INT ceiling before overflow causes primary-key exhaustion and write failures. The caveat is that the migration itself does not scale to very large tables without online-DDL tooling — plan the cutover around table size, not around the package.
Failure modes
ALTER.down) is expensive and may not faithfully restore dropped constraints.Ramp-up Low. A mid-level Laravel engineer can install and run the tool in under an hour. The genuine effort — and where a TPM should staff — is schema review, staging rehearsal, and cutover coordination, not the package itself. Budget roughly one engineer-week for a mid-sized schema, dominated by review and verification rather than execution.
How can I help you explore Laravel packages today?