Differential D2674 Diff 7933 src/database/migrations/2021_03_25_144555_create_auth_attempts_table.php
Changeset View
Changeset View
Standalone View
Standalone View
src/database/migrations/2021_03_25_144555_create_auth_attempts_table.php
- This file was added.
<?php | |||||
use Illuminate\Database\Migrations\Migration; | |||||
use Illuminate\Database\Schema\Blueprint; | |||||
use Illuminate\Support\Facades\Schema; | |||||
// phpcs:ignore | |||||
class CreateAuthAttemptsTable extends Migration | |||||
{ | |||||
/** | |||||
* Run the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function up() | |||||
{ | |||||
Schema::create('auth_attempts', function (Blueprint $table) { | |||||
$table->bigIncrements('id'); | |||||
$table->bigInteger('user_id'); | |||||
$table->string('ip', 36); | |||||
machniak: This index is redundant, I think. | |||||
Done Inline ActionsThe user_id index? You mean because of the [user_id, ip] index blow? mollekopf: The user_id index? You mean because of the [user_id, ip] index blow? | |||||
$table->string('status', 36)->default('NEW'); | |||||
$table->string('reason', 36)->nullable(); | |||||
$table->datetime('expires_at')->nullable(); | |||||
$table->datetime('last_seen')->nullable(); | |||||
$table->timestamps(); | |||||
Done Inline ActionsAn index on updated_at would be useful when running the purge command. machniak: An index on updated_at would be useful when running the purge command. | |||||
$table->index('updated_at'); | |||||
$table->unique(['user_id', 'ip']); | |||||
Done Inline ActionsShould that be a unique index? machniak: Should that be a unique index? | |||||
$table->foreign('user_id') | |||||
->references('id')->on('users') | |||||
->onDelete('cascade') | |||||
->onUpdate('cascade'); | |||||
}); | |||||
} | |||||
/** | |||||
* Reverse the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function down() | |||||
{ | |||||
Schema::dropIfExists('auth_attempts'); | |||||
} | |||||
} |
This index is redundant, I think.