diff --git a/resources/sql/autopatches/20180214.harbor.01.aborted.php b/resources/sql/autopatches/20180214.harbor.01.aborted.php new file mode 100644 index 0000000000..689d5625f5 --- /dev/null +++ b/resources/sql/autopatches/20180214.harbor.01.aborted.php @@ -0,0 +1,27 @@ +establishConnection('w'); + +foreach (new LiskMigrationIterator($table) as $buildable) { + if ($buildable->getBuildableStatus() !== 'building') { + continue; + } + + $aborted = queryfx_one( + $conn, + 'SELECT * FROM %T WHERE buildablePHID = %s AND buildStatus = %s', + id(new HarbormasterBuild())->getTableName(), + $buildable->getPHID(), + 'aborted'); + if (!$aborted) { + continue; + } + + queryfx( + $conn, + 'UPDATE %T SET buildableStatus = %s WHERE id = %d', + $table->getTableName(), + 'failed', + $buildable->getID()); +}