Skip to content

Conversation

@nguyentranchung
Copy link
Contributor

Motivation

Every time I create a migration, I get confused about the value ranges for different integer types. I have to remember or calculate what range a 1-byte, 2-byte, 3-byte, or 4-byte integer can hold. This mental overhead slows down development and can lead to choosing the wrong column type.

Changes

This PR enhances the docblocks for integer and text column methods in the Blueprint class to include:

Integer Columns

  • Concrete value ranges for both signed and unsigned integers
  • Examples:
    • tinyInteger(): -128 to 127 (signed) or 0 to 255 (unsigned)
    • integer(): -2,147,483,648 to 2,147,483,647 (signed) or 0 to 4,294,967,295 (unsigned)
    • bigInteger(): Full 64-bit ranges displayed

Text Columns

  • Maximum character limits with size context
  • Examples:
    • tinyText(): up to 255 characters
    • text(): up to 65,535 characters (~64 KB)
    • mediumText(): up to 16,777,215 characters (~16 MB)
    • longText(): up to 4,294,967,295 characters (~4 GB)

Benefits

  • Faster development: No need to look up or calculate ranges
  • Better column type selection: Choose the right type at a glance
  • Reduced errors: Less likely to pick an insufficient column type
  • Improved DX: Information available right in IDE autocomplete/hover

Example

Before:

// Have to remember: "How big is a mediumInteger again?"
$table->mediumInteger('quantity');

After:

// IDE shows: "3-byte, Range: -8,388,608 to 8,388,607 (signed)..."
$table->mediumInteger('quantity'); // Perfect for my use case!

@nguyentranchung nguyentranchung changed the base branch from master to 12.x December 4, 2025 21:01
@nguyentranchung nguyentranchung changed the title Improve Blueprint docblocks with concrete value ranges for integer and text columns [12.x] Improve Blueprint docblocks with concrete value ranges for integer and text columns Dec 4, 2025
@taylorotwell taylorotwell merged commit dce9d65 into laravel:12.x Dec 5, 2025
3 checks passed
@nguyentranchung nguyentranchung deleted the pr branch December 5, 2025 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants