jeudi 29 juin 2017

laravel 5.4 database charset & collation for binary types

I have a requirement in my project to store images in a database, the current column type is TEXT so when trying to store an image sql throws an error about string being too long. So I created a migration

    Schema::table('pages', function (Blueprint $table) {
        $table->binary('extras')->change();
    });

when I run the migration it throws an error

SQLSTATE[42000]: Syntax error or access violation: 1253 COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'binary' (SQL: ALTER TABLE pages CHANGE extras extras B LOB DEFAULT NULL COLLATE utf8mb4_unicode_ci)

im using the default collation and charset in config.database

        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',

Do these not support blob formats? if not what is the correct settings for this, I have no need for unicode or emoji support.

I am using mysql v5.7



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire