| @@ 61-74 (lines=14) @@ | ||
| 58 | ||
| 59 | $field_ids = array_merge($author, $checkbox, $date, $input, $textarea, $upload); |
|
| 60 | ||
| 61 | foreach ($field_ids as $id) { |
|
| 62 | $table = '`tbl_entries_data_' . $id . '`'; |
|
| 63 | ||
| 64 | try { |
|
| 65 | Symphony::Database()->query("ALTER TABLE " . $table . " DROP INDEX `entry_id`"); |
|
| 66 | } catch (Exception $ex) { |
|
| 67 | } |
|
| 68 | ||
| 69 | try { |
|
| 70 | Symphony::Database()->query("CREATE UNIQUE INDEX `entry_id` ON " . $table . " (`entry_id`)"); |
|
| 71 | Symphony::Database()->query("OPTIMIZE TABLE " . $table); |
|
| 72 | } catch (Exception $ex) { |
|
| 73 | } |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||
| 77 | // Update the version information |
|
| @@ 139-153 (lines=15) @@ | ||
| 136 | $author_fields = Symphony::Database()->fetchCol("field_id", |
|
| 137 | "SELECT `field_id` FROM `tbl_fields_author`"); |
|
| 138 | ||
| 139 | foreach ($author_fields as $id) { |
|
| 140 | $table = 'tbl_entries_data_' . $id; |
|
| 141 | ||
| 142 | // MySQL doesn't support DROP IF EXISTS, so we'll try and catch. |
|
| 143 | try { |
|
| 144 | Symphony::Database()->query("ALTER TABLE `" . $table . "` DROP INDEX `entry_id`"); |
|
| 145 | } catch (Exception $ex) { |
|
| 146 | } |
|
| 147 | ||
| 148 | try { |
|
| 149 | Symphony::Database()->query("CREATE UNIQUE INDEX `author` ON `" . $table . "` (`entry_id`, `author_id`)"); |
|
| 150 | Symphony::Database()->query("OPTIMIZE TABLE " . $table); |
|
| 151 | } catch (Exception $ex) { |
|
| 152 | } |
|
| 153 | } |
|
| 154 | ||
| 155 | // Move section sorting data from the database to the filesystem. #977 |
|
| 156 | if (Symphony::Database()->tableContainsField('tbl_sections', 'entry_order')) { |
|