* Backup/Addressbook: adding limited index-length to backed up schema and fix restore of old backups without (default to 32 on multicolumn indexes including text columns)

This commit is contained in:
Ralf Becker 2012-04-12 08:04:35 +00:00
parent 5e66d1a2ce
commit 18d74430ea
2 changed files with 15 additions and 8 deletions

View File

@ -114,7 +114,8 @@ class ADODB_mysql extends ADOConnection {
);
}
$indexes[$row[2]]['columns'][$row[3] - 1] = $row[4];
$indexes[$row[2]]['columns'][$row[3] - 1] = $row[4].
(is_numeric($row[7]) ? '('.(int)$row[7].')' : '');
}
// sort columns by order in the index

View File

@ -226,25 +226,31 @@ class schema_proc
if (isset($mFields['options'][$this->sType]))
{
$options = $mFields['options'][$this->sType]; // db-specific options, eg. index-type
if (!$options) continue; // no index for our db-type
}
unset($mFields['options']);
}
}
else
foreach((array)$mFields as $k => $col)
{
// only create indexes on text-columns, if (db-)specifiy options are given or FULLTEXT for mysql
// most DB's cant do them and give errors
if (in_array($aTableDef['fd'][$mFields]['type'],array('text','longtext')))
if (in_array($aTableDef['fd'][$col]['type'],array('text','longtext')))
{
if ($this->sType == 'mysql')
if (is_array($mFields)) // index over multiple columns including a text column
{
$options = 'FULLTEXT';
$mFields[$k] .= '(32)'; // 32=limit of egw_addressbook_extra.extra_value to fix old backups
}
else
elseif (!$options) // index over a single text column and no options given
{
continue; // ignore that index
if ($this->sType == 'mysql')
{
$options = 'FULLTEXT';
}
else
{
continue 2; // ignore that index, 2=not just column but whole index!
}
}
}
}