A
A
Alex Wells2016-10-02 13:55:45
MySQL
Alex Wells, 2016-10-02 13:55:45

UUID String vs Char vs Binary. What's better?

Hello. I use UUID because I need to quickly and independently insert a large number of columns into a table without creating a LOCK. I also use Laravel 5.3. At the moment, the framework does not have the ability to transform fields upon request, for example, to binary. I tried to fence my transformers, and they even worked, but for some reason third-party packages like to use raw query builder. More shortly, physically I cannot use binary.
The next question is about string vs char.. what needs to be done to make laravel work fine with char? Can MySQL automatically convert string to char? Will I have to make some crutches, and will it be more difficult than string? If not, is char better than string? How?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrzej Wielski, 2016-10-03
@Alex_Wells

The next question is about string vs char.. what needs to be done to make laravel work fine with char? Can MySQL automatically convert string to char? Will I have to make some crutches, and will it be more difficult than string? If not, is char better than string? How?

First, MySQL does not have a "string" data type. There is a varchar.
Apparently, you skimmed through the migrations, and saw something like this:
Schema::create('...', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');

So, string == varchar .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question