What do you want to store there? If storing UUID, then varchar field.
Feb 19, 2021
4
Level 10
Datatype binary
There is a character datatype BINARY in mysql. https://dev.mysql.com/doc/refman/5.7/en/binary-varbinary.html
"The BINARY types are similar to CHAR (...) That is, they store byte strings rather than character strings."
I came across an application which stores UUIDs (with length 32, without hyphens) as table-id.
But if using the Laravel datatype BINARY in a migration, it creates a BLOB, which is different.
Any idea how I can use this id in Laravel?
Thanks Grestock
Level 8
Just want to post this here for anyone that comes across. It's possible with standard Laravel syntax using charset to do a 'normal' binary column.
$table->char('uuid', 16)->charset('binary');
1 like
Please or to participate in this conversation.