| @@ 207-225 (lines=19) @@ | ||
| 204 | } |
|
| 205 | $suggestions[] = $suggestion; |
|
| 206 | } |
|
| 207 | if (!empty($addCreateChange['change'])) { |
|
| 208 | $suggestion = [ |
|
| 209 | 'key' => 'change', |
|
| 210 | 'label' => 'Change fields', |
|
| 211 | 'enabled' => false, |
|
| 212 | 'children' => [], |
|
| 213 | ]; |
|
| 214 | foreach ($addCreateChange['change'] as $hash => $statement) { |
|
| 215 | $child = [ |
|
| 216 | 'hash' => $hash, |
|
| 217 | 'statement' => $statement, |
|
| 218 | ]; |
|
| 219 | if (isset($addCreateChange['change_currentValue'][$hash])) { |
|
| 220 | $child['current'] = $addCreateChange['change_currentValue'][$hash]; |
|
| 221 | } |
|
| 222 | $suggestion['children'][] = $child; |
|
| 223 | } |
|
| 224 | $suggestions[] = $suggestion; |
|
| 225 | } |
|
| 226 | ||
| 227 | // Difference from current to expected |
|
| 228 | $dropRename = $schemaMigrationService->getUpdateSuggestions($sqlStatements, true); |
|
| @@ 232-250 (lines=19) @@ | ||
| 229 | ||
| 230 | // Aggregate the per-connection statements into one flat array |
|
| 231 | $dropRename = array_merge_recursive(...array_values($dropRename)); |
|
| 232 | if (!empty($dropRename['change_table'])) { |
|
| 233 | $suggestion = [ |
|
| 234 | 'key' => 'renameTableToUnused', |
|
| 235 | 'label' => 'Remove tables (rename with prefix)', |
|
| 236 | 'enabled' => false, |
|
| 237 | 'children' => [], |
|
| 238 | ]; |
|
| 239 | foreach ($dropRename['change_table'] as $hash => $statement) { |
|
| 240 | $child = [ |
|
| 241 | 'hash' => $hash, |
|
| 242 | 'statement' => $statement, |
|
| 243 | ]; |
|
| 244 | if (!empty($dropRename['tables_count'][$hash])) { |
|
| 245 | $child['rowCount'] = $dropRename['tables_count'][$hash]; |
|
| 246 | } |
|
| 247 | $suggestion['children'][] = $child; |
|
| 248 | } |
|
| 249 | $suggestions[] = $suggestion; |
|
| 250 | } |
|
| 251 | if (!empty($dropRename['change'])) { |
|
| 252 | $suggestion = [ |
|
| 253 | 'key' => 'renameTableFieldToUnused', |
|
| @@ 281-299 (lines=19) @@ | ||
| 278 | } |
|
| 279 | $suggestions[] = $suggestion; |
|
| 280 | } |
|
| 281 | if (!empty($dropRename['drop_table'])) { |
|
| 282 | $suggestion = [ |
|
| 283 | 'key' => 'deleteTable', |
|
| 284 | 'label' => 'Drop tables (really!)', |
|
| 285 | 'enabled' => false, |
|
| 286 | 'children' => [], |
|
| 287 | ]; |
|
| 288 | foreach ($dropRename['drop_table'] as $hash => $statement) { |
|
| 289 | $child = [ |
|
| 290 | 'hash' => $hash, |
|
| 291 | 'statement' => $statement, |
|
| 292 | ]; |
|
| 293 | if (!empty($dropRename['tables_count'][$hash])) { |
|
| 294 | $child['rowCount'] = $dropRename['tables_count'][$hash]; |
|
| 295 | } |
|
| 296 | $suggestion['children'][] = $child; |
|
| 297 | } |
|
| 298 | $suggestions[] = $suggestion; |
|
| 299 | } |
|
| 300 | ||
| 301 | $messageQueue->enqueue(new FlashMessage( |
|
| 302 | '', |
|