Fix FULLTEXT column generation

Fixes #3618
This commit is contained in:
mark_story 2013-02-12 09:00:57 -05:00
parent e0a9dd81f8
commit 0d9ef854ff
3 changed files with 5 additions and 3 deletions

View file

@ -586,8 +586,11 @@ class Mysql extends DboSource {
}
$name = $this->startQuote . $name . $this->endQuote;
}
// length attribute only used for MySQL datasource, for TEXT/BLOB index columns
if (isset($value['type']) && strtolower($value['type']) === 'fulltext') {
$out .= 'FULLTEXT ';
}
$out .= 'KEY ' . $name . ' (';
if (is_array($value['column'])) {
if (isset($value['length'])) {
$vals = array();

View file

@ -3170,8 +3170,6 @@ class DboSource extends DataSource {
} else {
if (!empty($value['unique'])) {
$out .= 'UNIQUE ';
} elseif (!empty($value['type']) && strtoupper($value['type']) === 'FULLTEXT') {
$out .= 'FULLTEXT ';
}
$name = $this->startQuote . $name . $this->endQuote;
}

View file

@ -2984,6 +2984,7 @@ class MysqlTest extends CakeTestCase {
);
$result = $this->Dbo->buildIndex($data);
$expected = array('FULLTEXT KEY `MyFtIndex` (`name`, `description`)');
$this->assertEquals($expected, $result);
$data = array(
'MyTextIndex' => array('column' => 'text_field', 'length' => array('text_field' => 20))