--- a/Command/CreateFullTextIndexesCommand.php Fri Oct 28 14:57:11 2011 +0200
+++ b/Command/CreateFullTextIndexesCommand.php Fri Nov 04 11:56:59 2011 +0100
@@ -43,37 +43,10 @@
$simulate = true;
}
- $sql_code = "";
- $fields = $this->getContainer()->getParameter('wiki_tag.fields');
- $def_columns = array();
- foreach ( $fields as $name => $field_def)
- {
- if(isset($field_def['type']))
- {
- $type = $field_def['type'];
- }
- if(!isset($type) || is_null($type) || strlen($type) == 0)
- {
- $type = "text";
- }
-
- if($type === 'text')
- {
- $def_column = "$name(4096)";
- }
- else
- {
- $def_column = $name;
- }
- $def_columns[] = $def_column;
-
- $sql_code .= "ALTER IGNORE TABLE wikitag_document DROP INDEX ${name}_document_fulltext_idx;\n";
- $sql_code .= "ALTER TABLE wikitag_document ADD FULLTEXT INDEX ${name}_document_fulltext_idx ($def_column);\n";
- }
+
+ $schema_utils = $this->getContainer()->get("wikitag.shema_utils");
- $sql_code .= "ALTER IGNORE TABLE wikitag_document DROP INDEX all_document_fulltext_idx;\n";
- $sql_code .= "ALTER TABLE wikitag_document ADD FULLTEXT INDEX all_document_fulltext_idx (".join(",", $def_columns).");\n";
-
+ $sql_code = implode(";".PHP_EOL, $schema_utils->createFullTextIndexes());
if($simulate)
{