【问题标题】:CakePHP 3 - Migrations - Specify Key Length for Text Column IndexCakePHP 3 - 迁移 - 指定文本列索引的键长度
【发布时间】:2020-02-20 10:48:12
【问题描述】:

我正在尝试向我的一张表添加索引,但出现以下错误

 1170 BLOB/TEXT column 'slug' used in key specification without a key length

这是我正在使用的代码

 $tableFAQTopics->addIndex('slug');

指定密钥长度的选项是什么样的,我不确定用于密钥长度的数组密钥...

它应该看起来像这样,我不确定在问号所在的位置放什么

$tableFAQTopics->addIndex('slug', ['??????' => 16]);

【问题讨论】:

    标签: cakephp cakephp-3.x cakephp-3.7


    【解决方案1】:

    我在phinx documentation找到了答案

    $tableFAQTopics->addIndex('slug', ['limit' => 16]);
    

    【讨论】:

      猜你喜欢
      • 2020-01-08
      • 2014-09-07
      • 2011-05-25
      • 1970-01-01
      • 2015-10-20
      • 2014-07-10
      • 2016-12-02
      • 1970-01-01
      • 2011-09-04
      相关资源
      最近更新 更多