Laravel add CLOB column

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 02:21:48

问题


Hey I've searched everywhere on google and In Laravel documentation and I couldn't find how can I add CLOB field to the table. Is it possible?

$table->clob('test'); 

Isn't working.


回答1:


Laravel's schema manager doesn't support all column types.

Medium and long blobs arent supported so I guess cblob isnt any aswell

https://github.com/laravel/framework/issues/3544

There is a way to do it raw quires DB::statement in a migration.

Take a look at this answer

MediumBlob in Laravel database schema

TL;DR

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");


来源:https://stackoverflow.com/questions/51824304/laravel-add-clob-column

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!