小编tsa*_*hev的帖子

Yii2 - 使用 LONGBLOB 字段创建迁移

我想创建一个包含LONGBLOB字段的表。

'image' => $this->binary(),
Run Code Online (Sandbox Code Playgroud)

在表中生成BLOB字段。

除了对特定字段使用原始SQL语法之外,还有其他方法可以生成LONGBLOB字段吗?

下面是我创建表的完整代码。

    $this->createTable('edition_images', [
        'image_id' => $this->bigPrimaryKey()->unsigned(),

        'embed_url' => $this->string()->notNull(),

        'image_type' => $this->string(),
        'image_md5' => $this->string(),
        //'image' => $this->binary(),
        '`image` longblob NULL',

        'title_en' => $this->string(),
        'title_bg' => $this->string(),
        'title_ro' => $this->string(),

        'order' => $this->bigInteger(20)->unsigned()->null(),

        'edition_id' => $this->bigInteger(20)->unsigned()->notNull(),

        'created_by' => $this->bigInteger(20)->unsigned()->notNull(),
        'created_at' => $this->timestamp()->notNull()->defaultExpression('CURRENT_TIMESTAMP'),
        'updated_by' => $this->bigInteger(20)->unsigned()->null(),
        'updated_at' => $this->timestamp()->null()->defaultValue(null)->append('ON UPDATE CURRENT_TIMESTAMP'),
        'deleted_by' => $this->bigInteger(20)->unsigned()->null(),
        'deleted_at' => $this->timestamp()->null(),
        'deleted' => $this->integer(1),
    ]);
Run Code Online (Sandbox Code Playgroud)

mysql yii2

1
推荐指数
1
解决办法
4411
查看次数

标签 统计

mysql ×1

yii2 ×1