diff --git a/database/migrations/2021_08_03_210600_change_successful_field_to_default_to_false_on_backups_table.php b/database/migrations/2021_08_03_210600_change_successful_field_to_default_to_false_on_backups_table.php
index 1dddb7f3b..d47b0e5d2 100644
--- a/database/migrations/2021_08_03_210600_change_successful_field_to_default_to_false_on_backups_table.php
+++ b/database/migrations/2021_08_03_210600_change_successful_field_to_default_to_false_on_backups_table.php
@@ -1,5 +1,6 @@
 <?php
 
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Schema;
 use Illuminate\Database\Schema\Blueprint;
 use Illuminate\Database\Migrations\Migration;
diff --git a/database/migrations/2021_08_21_175111_add_foreign_keys_to_mount_node_table.php b/database/migrations/2021_08_21_175111_add_foreign_keys_to_mount_node_table.php
new file mode 100644
index 000000000..fad8dc193
--- /dev/null
+++ b/database/migrations/2021_08_21_175111_add_foreign_keys_to_mount_node_table.php
@@ -0,0 +1,59 @@
+<?php
+
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddForeignKeysToMountNodeTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        // Fix the columns having a different type than their relations.
+        Schema::table('mount_node', function (Blueprint $table) {
+            $table->unsignedInteger('node_id')->change();
+            $table->unsignedInteger('mount_id')->change();
+        });
+
+        // Fetch an array of node and mount ids to check relations against.
+        $nodes = DB::table('nodes')->select('id')->pluck('id')->toArray();
+        $mounts = DB::table('mounts')->select('id')->pluck('id')->toArray();
+
+        // Drop any relations that are missing a node or mount.
+        DB::table('mount_node')
+            ->select('node_id', 'mount_id')
+            ->whereNotIn('node_id', $nodes)
+            ->orWhereNotIn('mount_id', $mounts)
+            ->delete();
+
+        Schema::table('mount_node', function (Blueprint $table) {
+            $table->foreign('node_id')
+                ->references('id')
+                ->on('nodes')
+                ->cascadeOnDelete()
+                ->cascadeOnUpdate();
+            $table->foreign('mount_id')->references('id')
+                ->on('mounts')
+                ->cascadeOnDelete()
+                ->cascadeOnUpdate();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('mount_node', function (Blueprint $table) {
+            $table->dropForeign(['node_id']);
+            $table->dropForeign(['mount_id']);
+        });
+    }
+}
diff --git a/database/migrations/2021_08_21_175118_add_foreign_keys_to_mount_server_table.php b/database/migrations/2021_08_21_175118_add_foreign_keys_to_mount_server_table.php
new file mode 100644
index 000000000..9c5a403b2
--- /dev/null
+++ b/database/migrations/2021_08_21_175118_add_foreign_keys_to_mount_server_table.php
@@ -0,0 +1,58 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddForeignKeysToMountServerTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        // Fix the columns having a different type than their relations.
+        Schema::table('mount_server', function (Blueprint $table) {
+            $table->unsignedInteger('server_id')->change();
+            $table->unsignedInteger('mount_id')->change();
+        });
+
+        // Fetch an array of node and mount ids to check relations against.
+        $servers = DB::table('servers')->select('id')->pluck('id')->toArray();
+        $mounts = DB::table('mounts')->select('id')->pluck('id')->toArray();
+
+        // Drop any relations that are missing a server or mount.
+        DB::table('mount_server')
+            ->select('server_id', 'mount_id')
+            ->whereNotIn('server_id', $servers)
+            ->orWhereNotIn('mount_id', $mounts)
+            ->delete();
+
+        Schema::table('mount_server', function (Blueprint $table) {
+            $table->foreign('server_id')
+                ->references('id')
+                ->on('servers')
+                ->cascadeOnDelete()
+                ->cascadeOnUpdate();
+            $table->foreign('mount_id')->references('id')
+                ->on('mounts')
+                ->cascadeOnDelete()
+                ->cascadeOnUpdate();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('mount_server', function (Blueprint $table) {
+            $table->dropForeign(['server_id']);
+            $table->dropForeign(['mount_id']);
+        });
+    }
+}
diff --git a/database/migrations/2021_08_21_180921_add_foreign_keys_to_egg_mount_table.php b/database/migrations/2021_08_21_180921_add_foreign_keys_to_egg_mount_table.php
new file mode 100644
index 000000000..7bf99506b
--- /dev/null
+++ b/database/migrations/2021_08_21_180921_add_foreign_keys_to_egg_mount_table.php
@@ -0,0 +1,58 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddForeignKeysToEggMountTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        // Fix the columns having a different type than their relations.
+        Schema::table('egg_mount', function (Blueprint $table) {
+            $table->unsignedInteger('egg_id')->change();
+            $table->unsignedInteger('mount_id')->change();
+        });
+
+        // Fetch an array of node and mount ids to check relations against.
+        $eggs = DB::table('eggs')->select('id')->pluck('id')->toArray();
+        $mounts = DB::table('mounts')->select('id')->pluck('id')->toArray();
+
+        // Drop any relations that are missing an egg or mount.
+        DB::table('egg_mount')
+            ->select('egg_id', 'mount_id')
+            ->whereNotIn('egg_id', $eggs)
+            ->orWhereNotIn('mount_id', $mounts)
+            ->delete();
+
+        Schema::table('egg_mount', function (Blueprint $table) {
+            $table->foreign('egg_id')
+                ->references('id')
+                ->on('eggs')
+                ->cascadeOnDelete()
+                ->cascadeOnUpdate();
+            $table->foreign('mount_id')->references('id')
+                ->on('mounts')
+                ->cascadeOnDelete()
+                ->cascadeOnUpdate();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('egg_mount', function (Blueprint $table) {
+            $table->dropForeign(['egg_id']);
+            $table->dropForeign(['mount_id']);
+        });
+    }
+}