Skip to content

Conversation

@hafezdivandari
Copy link
Contributor

@hafezdivandari hafezdivandari commented Mar 4, 2024

This PR adds support for binary(n) and varbinary(n) column types on databases that support this type (MySQL, MariaDB and SQL Server).

PS: No upgrade guide entry is needed.

Usage

Schema::binary('test', function (Blueprint $table) {
    $table->binary('blob_column'); // no change
    // `BLOB` on MySQL, MariaDB, and SQLite, `BYTEA` on PostgreSQL, `VARBINARY(MAX)` on SQL Server

    $table->binary('varbinary_column', length: 16);
    // `VARBINARY(16)` on MySQL, MariaDB, and SQL Server, `BLOB` on SQLite, `BYTEA` on PostgreSQL

    $table->binary('binary_column', length: 16, fixed: true);
    // `BINARY(16)` on MySQL, MariaDB, and SQL Server, `BLOB` on SQLite, `BYTEA` on PostgreSQL
});
Syntax MySQL / MariaDB SQL Server SQLite PostgreSQL
binary('name') BLOB VARBINARY(MAX) BLOB BYTEA
binary('name', length: 16) VARBINARY(16) VARBINARY(16) BLOB BYTEA
binary('name', length: 16, fixed: true) BINARY(16) BINARY(16) BLOB BYTEA

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