mysql – Laravel数据库模式中的MediumBlob

栏目: PHP · 发布时间: 7年前

内容简介:翻译自:https://stackoverflow.com/questions/20089652/mediumblob-in-laravel-database-schema

如何在 Laravel 架构构建器中创建Mediumblob?

在文档中它说:

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

但我需要一个MediumBlob,否则图像会被截断为64K;我们正在运行MySQL.

我知道Laravel的架构生成器与数据库无关,但有没有办法避免“本机方式”,如果不能,我怎样才能创建一个Mediumblob列?

你不能.

issue 建议使用原始查询来创建此类列,因此您应该在迁移文件中执行以下操作:

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/20089652/mediumblob-in-laravel-database-schema


以上所述就是小编给大家介绍的《mysql – Laravel数据库模式中的MediumBlob》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Developing Large Web Applications

Developing Large Web Applications

Kyle Loudon / Yahoo Press / 2010-3-15 / USD 34.99

As web applications grow, so do the challenges. These applications need to live up to demanding performance requirements, and be reliable around the clock every day of the year. And they need to withs......一起来看看 《Developing Large Web Applications》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

html转js在线工具
html转js在线工具

html转js在线工具