summaryrefslogtreecommitdiff
path: root/lib/schema.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-11-01 13:27:44 -0700
committerBrion Vibber <brion@pobox.com>2010-11-01 13:27:44 -0700
commit692ef9c3309bde60346beb32386ff17157e0a5e2 (patch)
treed07defd6b9e6e95e5c30eb5c2234dce7f5ed8fb2 /lib/schema.php
parent96521f38d2f6db7a85e17f2f7f6e4eabeaa06cf8 (diff)
Include fulltext indexes in MySQL table create
Diffstat (limited to 'lib/schema.php')
-rw-r--r--lib/schema.php25
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/schema.php b/lib/schema.php
index 671af8a21..2e2795588 100644
--- a/lib/schema.php
+++ b/lib/schema.php
@@ -168,17 +168,24 @@ class Schema
}
}
- // Multi-value indexes are advisory and for best portability
- // should be created as separate statements.
+ // Wrap the CREATE TABLE around the main body chunks...
$statements = array();
$statements[] = $this->startCreateTable($name, $def) . "\n" .
implode($sql, ",\n") . "\n" .
$this->endCreateTable($name, $def);
+
+ // Multi-value indexes are advisory and for best portability
+ // should be created as separate statements.
if (!empty($def['indexes'])) {
foreach ($def['indexes'] as $col => $colDef) {
$this->appendCreateIndex($statements, $name, $col, $colDef);
}
}
+ if (!empty($def['fulltext indexes'])) {
+ foreach ($def['fulltext indexes'] as $col => $colDef) {
+ $this->appendCreateFulltextIndex($statements, $name, $col, $colDef);
+ }
+ }
return $statements;
}
@@ -283,6 +290,20 @@ class Schema
}
/**
+ * Append an SQL statement with an index definition for a full-text search
+ * index over one or more columns on a table.
+ *
+ * @param array $statements
+ * @param string $table
+ * @param string $name
+ * @param array $def
+ */
+ function appendCreateFulltextIndex(array &$statements, $table, $name, array $def)
+ {
+ throw new Exception("Fulltext index not supported in this database");
+ }
+
+ /**
* Append an SQL statement to drop an index from a table.
*
* @param array $statements