MediumBlob in Laravel database schema

后端 未结 2 1103
迷失自我
迷失自我 2020-12-06 10:42

How can I create a Mediumblob within the Laravel schema builder ?

In the docs it says :

$table->binary(\'data\'); // BLOB equivalent          


        
2条回答
  •  感情败类
    2020-12-06 11:01

    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("", 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 
    ADD MEDIUMBLOB");

    提交回复
    热议问题