Skip to content

Commit

Permalink
Ensure configureerror FK types match (#2582)
Browse files Browse the repository at this point in the history
CDash databases that were initialized in v2.5 or older have a type
mismatch between configure.id (int) and configureerror.configureid
(bigint). See #506 for more context about where this mismatch occurred.

Update the recent migration so that these types match and we can apply
the foreign key successfully.
  • Loading branch information
zackgalbreath authored Nov 22, 2024
1 parent f92fd02 commit 74041b5
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
*/
public function up(): void
{
echo 'Converting configureerror.configureid to int' . PHP_EOL;
Schema::table('configureerror', function (Blueprint $table) {
$table->integer('configureid')->change();
});

echo "Adding foreign key constraint configureerror(configureid)->configure(id)...";
$num_deleted = DB::delete("DELETE FROM configureerror WHERE configureid NOT IN (SELECT id FROM configure)");
echo $num_deleted . ' invalid rows deleted' . PHP_EOL;
Expand Down

0 comments on commit 74041b5

Please sign in to comment.