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