laravel / framework

The Laravel Framework.

Home Page:https://laravel.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

binary() field in Schema Builder

aklinkert opened this issue · comments

I hardly need to create a column of type binary$length) in MySQL but had to assert, that the $fluent->binary() method isn't building a BINARY but a BLOB field.

So what could be a possible sulution for this? Adding a new Fluent Method? In Laravel 3 I was easyly able to hack and dirty change the frameworks code to my needings, but with composer it luckily not possible.

Any ideas guys?

Cheers,
Bodo06

Just do a DB::statement call and run the raw SQL you need to generate your column.

The only reason I can think of why this isn't implemented is that not all database types support the binary column. If that isn't the case, I would really like to see this added to Laravel.

I'd definitely agree that this should be supported in some form, primarily for support for UUIDs.

commented

+1 for adding binary support

I agree this is a bug, binary isn't the blob in mysql

It seems like you can just set the character set to binary as a workaround:

$table->char('url_hash', 16)->charset('binary');

This is actually shown as a real binary column type with a length of 16 in MySQL Workbench.