Update data/params after Bugzilla 4.2.11 upgrade
[WebKit-https.git] / Websites / perf.webkit.org / public / admin / platforms.php
index 487ee9c..4cc87ac 100644 (file)
@@ -11,7 +11,9 @@ function merge_platforms($platform_to_merge, $destination_platform) {
     // exist in both the original platform and the platform into which we're merging.
     if (!$db->query_and_get_affected_rows('UPDATE test_runs SET run_config = destination.config_id
         FROM test_configurations as merged, test_configurations as destination
-        WHERE merged.config_platform = $1 AND destination.config_platform = $2 AND run_config = merged.config_id
+        WHERE merged.config_platform = $1 AND destination.config_platform = $2
+            AND run_config = merged.config_id
+            AND destination.config_type = merged.config_type
             AND destination.config_metric = merged.config_metric', array($platform_to_merge, $destination_platform))) {
         $db->rollback_transaction();
         return notice("Failed to migrate test runs for $platform_to_merge that have test configurations in $destination_platform.");
@@ -20,13 +22,14 @@ function merge_platforms($platform_to_merge, $destination_platform) {
     // Then migrate test configurations that don't exist in the destination platform to the new platform
     // so that test runs associated with those configurations are moved to the destination.
     if ($db->query_and_get_affected_rows('UPDATE test_configurations SET config_platform = $2
-        WHERE config_platform = $1 AND config_metric NOT IN (SELECT config_metric FROM test_configurations WHERE config_platform = $2)',
+        WHERE config_platform = $1 AND (config_metric NOT IN (SELECT config_metric FROM test_configurations WHERE config_platform = $2)
+            OR config_type NOT IN (SELECT config_type FROM test_configurations WHERE config_platform = $2))',
         array($platform_to_merge, $destination_platform)) === FALSE) {
         $db->rollback_transaction();
         return notice("Failed to migrate test configurations for $platform_to_merge.");
     }
 
-    if ($db->query_and_fetch_all('SELECT * FROM test_runs, test_configurations WHERE run_config = config_id AND config_platform = $1', array($platform_to_merge))) {
+    if ($db->query_and_fetch_all('SELECT * FROM test_runs, test_configurations WHERE run_config = config_id AND config_platform = $1 LIMIT 1', array($platform_to_merge))) {
         // We should never reach here.
         $db->rollback_transaction();
         return notice('Failed to migrate all test runs.');