Add all files
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('ext_security_suspended_accounts', function (Blueprint $table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->string('reason');
|
||||
$table->text('notes')->nullable();
|
||||
$table->boolean('is_permanent')->default(false);
|
||||
$table->timestamp('suspended_at');
|
||||
$table->timestamp('suspended_until')->nullable();
|
||||
$table->unsignedBigInteger('suspended_by'); // Admin user ID
|
||||
$table->timestamp('lifted_at')->nullable();
|
||||
$table->unsignedBigInteger('lifted_by')->nullable(); // Admin user ID
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'is_active']);
|
||||
$table->index(['suspended_until']);
|
||||
$table->index(['is_permanent']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('ext_security_suspended_accounts');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('ext_security_blocked_ips', function (Blueprint $table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->id();
|
||||
$table->string('ip_address');
|
||||
$table->string('reason');
|
||||
$table->text('notes')->nullable();
|
||||
$table->boolean('is_permanent')->default(false);
|
||||
$table->timestamp('blocked_at');
|
||||
$table->timestamp('blocked_until')->nullable();
|
||||
$table->unsignedBigInteger('blocked_by')->nullable(); // Admin user ID, null if auto-blocked
|
||||
$table->timestamp('unblocked_at')->nullable();
|
||||
$table->unsignedBigInteger('unblocked_by')->nullable(); // Admin user ID
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->integer('failed_login_attempts')->default(0);
|
||||
$table->timestamp('last_attempt_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['ip_address', 'is_active']);
|
||||
$table->index(['blocked_until']);
|
||||
$table->index(['is_permanent']);
|
||||
$table->index(['failed_login_attempts']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('ext_security_blocked_ips');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('ext_security_login_attempts', function (Blueprint $table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->id();
|
||||
$table->string('ip_address');
|
||||
$table->string('email')->nullable();
|
||||
$table->boolean('successful')->default(false);
|
||||
$table->string('user_agent')->nullable();
|
||||
$table->string('country')->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->timestamp('attempted_at');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['ip_address', 'attempted_at']);
|
||||
$table->index(['email', 'attempted_at']);
|
||||
$table->index(['successful']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('ext_security_login_attempts');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user