Skip to content

Add Postgres default int4 type to the number map #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2025

Conversation

billypoke
Copy link
Contributor

The integer column type in postgres is a 4 byte column by default, which is not currently mapped to the Number typescript type. This column would result from invoking $table->integer('foo'); in a laravel migration.

Schema::create('characters', function (Blueprint $table): void {
    ...
    $table->integer('character_id')->unique();
    ...
});

Test script

<?php

declare(strict_types=1);

$model = new \App\Models\Character();

$table = $model->getConnection()
    ->getSchemaBuilder()
    ->getColumns($model->getTable());

dd($table);

Which outputs

Other Columns...
2 => array:9 [
    "name" => "character_id"
    "type_name" => "int4"
    "type" => "integer"
    "collation" => null
    "nullable" => false
    "default" => null
    "auto_increment" => false
    "comment" => null
    "generation" => null
  ]
Other Columns...

@joetannenbaum
Copy link
Collaborator

Thanks!

@joetannenbaum joetannenbaum merged commit 149674c into laravel:main Aug 21, 2025
10 checks passed
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