- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/usertype.php
- Класс: CAllUserTypeEntity
- Вызов: CAllUserTypeEntity::CreatePropertyTables
function CreatePropertyTables($entity_id)
{
$connection = BitrixMainApplication::getConnection();
if (!$connection->isTableExists("b_utm_".strtolower($entity_id)))
{
$connection->createTable("b_utm_".strtolower($entity_id), [
'ID' => new BitrixMainORMFieldsIntegerField('ID'),
'VALUE_ID' => new BitrixMainORMFieldsIntegerField('VALUE_ID'),
'FIELD_ID' => new BitrixMainORMFieldsIntegerField('FIELD_ID'),
'VALUE' => new BitrixMainORMFieldsTextField('VALUE', ['nullable' => true]),
'VALUE_INT' => new BitrixMainORMFieldsIntegerField('VALUE_INT', ['nullable' => true]),
'VALUE_DOUBLE' => new BitrixMainORMFieldsFloatField('VALUE_DOUBLE', ['nullable' => true]),
'VALUE_DATE' => new BitrixMainORMFieldsDatetimeField('VALUE_DATE', ['nullable' => true]),
], ['ID'] ,['ID']);
$connection->createIndex("b_utm_".strtolower($entity_id), "ix_utm_".$entity_id."_2", ["VALUE_ID"]);
$connection->createIndex("b_utm_".strtolower($entity_id), "ix_utm_".$entity_id."_4", ["FIELD_ID", "VALUE_ID", "VALUE_INT"]);
}
if (!$connection->isTableExists("b_uts_".strtolower($entity_id)))
{
$connection->createTable("b_uts_".strtolower($entity_id), [
'VALUE_ID' => new BitrixMainORMFieldsIntegerField('VALUE_ID'),
], ['VALUE_ID']);
}
return true;
}