Index: branches/new-installer/phase3/includes/db/SchemaMysql.php |
— | — | @@ -1,6 +1,34 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class SchemaMysql extends SchemaBuilder { |
| 5 | + /** |
| 6 | + * BLOB or TEXT fields on MySQL require a length to be specified in |
| 7 | + * index declarations, otherwise CREATE INDEX will fail with error 1170. |
| 8 | + */ |
| 9 | + var $indexLengths = array( |
| 10 | + 'el_from' => array( |
| 11 | + 'el_to' => 40, |
| 12 | + ), |
| 13 | + 'el_to' => array( |
| 14 | + 'el_to' => 60, |
| 15 | + ), |
| 16 | + 'el_index' => array( |
| 17 | + 'el_index' => 60, |
| 18 | + ), |
| 19 | + 'ipb_address' => array( |
| 20 | + 'ipb_address' => 255, |
| 21 | + ), |
| 22 | + 'ipb_range' => array( |
| 23 | + 'ipb_range_start' => 8, |
| 24 | + 'ipb_range_end' => 8, |
| 25 | + ), |
| 26 | + 'oi_name_archive_name' => array( |
| 27 | + 'oi_name_archive_name' => 14, |
| 28 | + ), |
| 29 | + 'job_cmd' => array( |
| 30 | + 'job_params' => 128, |
| 31 | + ), |
| 32 | + ); |
5 | 33 | |
6 | 34 | public function getType() { |
7 | 35 | return 'mysql'; |
— | — | @@ -85,7 +113,11 @@ |
86 | 114 | } |
87 | 115 | $sql .= "{$this->tblPrefix}{$idx} ON $tblName ("; |
88 | 116 | foreach( $idxDef as $col ) { |
89 | | - $sql .= "{$prefix}{$col}, "; |
| 117 | + $field = "{$prefix}{$col}"; |
| 118 | + if ( isset( $this->indexLengths[$idx] ) && isset( $this->indexLengths[$idx][$field] ) ) { |
| 119 | + $field .= "({$this->indexLengths[$idx][$field]})"; |
| 120 | + } |
| 121 | + $sql .= "$field, "; |
90 | 122 | } |
91 | 123 | $sql = rtrim( $sql, ', ' ); |
92 | 124 | $sql .= ");\n"; |