LoginSignup
3
1

More than 5 years have passed since last update.

cakephp3 の Migration で mediumblob を認識させる

Posted at

ちょっと、はまったので防備録

        $table->addColumn('file_data', 'blob', [
            'default' => null,
            'limit' => 16777215,
            'null' => true,
        ]);

limit にサイズを指定するのがポイント
サイズは vendor\robmorgan\phinx\src\Phinx\Db\Adapter\MysqlAdapter.php にある以下の部分

    const BLOB_TINY    = 255;
    const BLOB_SMALL   = 255; /* deprecated, alias of BLOB_TINY */
    const BLOB_REGULAR = 65535;
    const BLOB_MEDIUM  = 16777215;
    const BLOB_LONG    = 4294967295;
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1