MediumBlob in Laravel database schema(Laravel 数据库模式中的 MediumBlob)
问题描述
如何在 Laravel 架构构建器中创建 Mediumblob
?
How can I create a Mediumblob
within the Laravel schema builder ?
在文档中它说:
$table->binary('data'); // BLOB equivalent to the table
但我需要一个 MediumBlob,否则图像会在 64K 时被截断;我们正在运行 MySQL.
But I need a MediumBlob otherwise the images get truncated at 64K; we are running MySQL.
我知道 Laravel 的架构构建器与数据库无关,但有没有办法避免原生方式",如果没有,我该如何创建 Mediumblob
列?
I know that Laravel's schema builder is DB agnostic, but is there a way to avoid the "native way" and if not how can i create a Mediumblob
column ?
推荐答案
你不能.
这个 issue 建议使用原始查询来创建此类列,因此您应该在迁移中执行类似的操作文件:
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");
这篇关于Laravel 数据库模式中的 MediumBlob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Laravel 数据库模式中的 MediumBlob


基础教程推荐
- 带更新的 sqlite CTE 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01