mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-09 05:54:34 +02:00
Add cascade delete on AuthLog table
This commit is contained in:
@ -41,11 +41,20 @@ return new class extends Migration
|
||||
$table->boolean('cleared_by_user')->default(false);
|
||||
$table->string('guard', 40)->nullable();
|
||||
$table->string('login_method', 40)->nullable();
|
||||
|
||||
$table->foreign('authenticatable_id')->references('id')->on('users')->cascadeOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::whenTableHasColumn('auth_logs', 'authenticatable_id', function (Blueprint $table) {
|
||||
// cannot drop foreign keys in SQLite:
|
||||
if (DB::getDriverName() !== 'sqlite') {
|
||||
$table->dropForeign(['authenticatable_id']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::dropIfExists('auth_logs');
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user