Laravel添加CLOB列 [英] Laravel add CLOB column
本文介绍了Laravel添加CLOB列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿,我已经在Google和Laravel文档中到处搜索了,但找不到如何将CLOB字段添加到表中.有可能吗?
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');
不起作用.
推荐答案
Laravel的架构管理器不支持所有列类型.
Laravel's schema manager doesn't support all column types.
支持中长点brent,所以我想cblob也不会
Medium and long blobs arent supported so I guess cblob isnt any aswell
https://github.com/laravel/framework/issues/3544
有一种方法可以在迁移中原始获取DB :: statement.
There is a way to do it raw quires DB::statement in a migration.
看看这个答案
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");
这篇关于Laravel添加CLOB列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文