binary() field in Schema Builder
aklinkert opened this issue ยท 10 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.
+1 for adding binary support
I agree this is a bug, binary isn't the blob in mysql
+1
+1
if you want migrations with more features use https://github.com/cakephp/phinx
it support binary, varbinary etc.
https://book.cakephp.org/3.0/en/phinx/migrations.html#valid-column-types
https://book.cakephp.org/3.0/en/phinx/migrations.html#valid-column-options
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.