【发布时间】:2016-02-24 19:57:56
【问题描述】:
我使用向 SugarCRM 中的自定义字段添加索引的官方方式为 "contacts_cstm" 表添加了以下索引:
$dictionary["accounts_cstm"] = array(
'table' => 'accounts_cstm',
'fields' => // We can add fields here, we must have at least the `id_c` field
array(
0 =>
array(
'name' => 'id_c',
'type' => 'id',
),
),
'indices' => // our custom indexes go here
array(
0 =>
array(
'name' => 'apellidos_nombre',
'type' => 'index',
'fields' =>
array(
0 => 'apellidos_c',
1 => 'nombre_c',
),
),
),
);
问题是我需要限制每个字段的密钥长度。在 SQL 中会是这样的:
ALTER TABLE contacts_cstm
ADD INDEX apellidos_nombre (apellidos_c (5), nombre_c (5));
如何在 SugarCRM 中执行此操作?提前感谢您的帮助!
【问题讨论】:
-
我认为您需要在字段定义中指定长度,添加索引将覆盖正在使用的字段上设置的长度
-
@EuphoriaGrogi 我找不到有关如何在字段定义中指定长度的文档。您有示例或教程吗?