How can I create a Mediumblob
within the Laravel schema builder ?
In the docs it says :
$table->binary(\'data\'); // BLOB equivalent
You can't.
This issue suggests using raw queries to create such columns, so you should do something like this in your migration file :
Schema::create("<table name>", function($table) {
// here you do all columns supported by the schema builder
});
// once the table is created use a raw query to ALTER it and add the MEDIUMBLOB
DB::statement("ALTER TABLE <table name> ADD <column name> MEDIUMBLOB");
The field is created but the file can not be inserted. And the following error is caused:
#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.