lundi 24 août 2015

How to store large data?

I know that MEDIUMBLOB is not supported, yet I need it to simplify my logic to store large JSON data (> 100 KB) in single field rather than splitting it into multiple smaller fields..

In my migration file, I did this:

Schema::create('trees', function(Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
            $table->smallInteger('country_id');
            $table->text('title');
            $table->smallInteger('level');
        });
DB::statement("ALTER TABLE trees ADD composition MEDIUMBLOB");

Then, when I try to store the data, I do:

\DB::table('trees')->where('id', $tree_id)->update(['composition' => json_encode($grades)]);

But, what I get is this error:

SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. (SQL: update trees set composition = [{"nodes":[{"nodes":

So, why I get this error ? , while in mySQ schema, I already used MEDIUMBLOB as a data type, which should be sufficient to store.

Any idea how to solve this?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1NEUlcf
via IFTTT

Aucun commentaire:

Enregistrer un commentaire