Index: trunk/extensions/Wikidata/Database scripts/Convenience/Create uw_expression indices.sql |
— | — | @@ -1,15 +0,0 @@ |
2 | | -ALTER TABLE `%dc%_expression` |
3 | | - ADD INDEX `versioned_end_expression` (`remove_transaction_id`, `expression_id`, `language_id`), |
4 | | - ADD INDEX `versioned_end_language` (`remove_transaction_id`, `language_id`, `expression_id`), |
5 | | - ADD INDEX `versioned_end_spelling` (`remove_transaction_id`, `spelling` (255), `expression_id`, `language_id`), |
6 | | - ADD INDEX `versioned_start_expression` (`add_transaction_id`, `expression_id`, `language_id`), |
7 | | - ADD INDEX `versioned_start_language` (`add_transaction_id`, `language_id`, `expression_id`), |
8 | | - ADD INDEX `versioned_start_spelling` (`add_transaction_id`, `spelling` (255), `expression_id`, `language_id`), |
9 | | - ADD INDEX `expressions_unique_idx` (`expression_id`,`language_id`), |
10 | | - ADD INDEX `expressions_idx` (`expression_id`), |
11 | | - ADD INDEX `language_idx` (`language_id`) |
12 | | - ; |
13 | | - |
Index: trunk/extensions/Wikidata/Database scripts/Convenience/Recreate indexes for all tables for website.php |
— | — | @@ -59,8 +59,7 @@ |
60 | 60 | $index = array(); |
61 | 61 | |
62 | 62 | foreach ($tableIndex->getColumns() as $column) { |
63 | | - $indexColumn = $column->getIdentifier(); |
64 | | - |
| 63 | + $indexColumn = '`' . $column->getIdentifier() . '`'; |
65 | 64 | $length = $column->getLength(); |
66 | 65 | |
67 | 66 | if ($length != null) |
— | — | @@ -105,7 +104,6 @@ |
106 | 105 | "collection_contents", |
107 | 106 | "collection", |
108 | 107 | "defined_meaning", |
109 | | - "expression", |
110 | 108 | "meaning_relations", |
111 | 109 | "option_attribute_options", |
112 | 110 | "option_attribute_values", |
— | — | @@ -117,11 +115,11 @@ |
118 | 116 | |
119 | 117 | $prefixes = retrieve_datasets(); |
120 | 118 | |
121 | | -//$dataSet = new WikiDataSet("uw"); |
122 | | -//recreateIndexesForTableNew($dataSet->expression); |
123 | | - |
124 | 119 | foreach($prefixes as $prefix) { |
125 | | - recreateIndexesForTables( $prefix, $tables ); |
| 120 | + $dataSet = new WikiDataSet($prefix); |
| 121 | + recreateIndexesForTableNew($dataSet->expression); |
| 122 | + |
| 123 | + recreateIndexesForTables($prefix, $tables); |
126 | 124 | } |
127 | 125 | |
128 | 126 | $endTime = time(); |
Index: trunk/extensions/Wikidata/Database scripts/Convenience/DatabaseUtilities.php |
— | — | @@ -27,15 +27,14 @@ |
28 | 28 | } |
29 | 29 | |
30 | 30 | function addIndexes($tableName, array $indexes) { |
31 | | - $dbr =& wfGetDB(DB_MASTER); |
| 31 | + if (count($indexes) > 0) { |
| 32 | + $dbr =& wfGetDB(DB_MASTER); |
| 33 | + $indexesSQL = array(); |
| 34 | + |
| 35 | + foreach ($indexes as $indexName => $columns) |
| 36 | + $indexesSQL[] = " ADD INDEX `" . $indexName . "` (" . implode(", ", $columns) .") "; |
32 | 37 | |
33 | | - $indexesSQL = array(); |
34 | | - |
35 | | - foreach ($indexes as $indexName => $columns) |
36 | | - $indexesSQL[] = " ADD INDEX `" . $indexName . "` (" . implode(", ", $columns) .") "; |
37 | | - |
38 | | - $sql = "ALTER TABLE " . $tableName . " " . implode(", ", $indexesSQL); |
39 | | - $dbr->query($sql); |
40 | | -} |
41 | | - |
42 | | - |
| 38 | + $sql = "ALTER TABLE " . $tableName . " " . implode(", ", $indexesSQL); |
| 39 | + $dbr->query($sql); |
| 40 | + } |
| 41 | +} |
\ No newline at end of file |