switch email to a primary key (#6064)

switching from a normal index here to a primary index works the same except for adding a `UNIQUE` constraint.

The `DatabaseTokenRepository` deletes existing records with an email first, before creating a new one, so this additional constraint will be okay.

https://github.com/laravel/framework/blob/9.x/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php#L88
This commit is contained in:
Andrew Brown 2023-01-02 08:45:35 -06:00 committed by GitHub
parent ca01443b96
commit 091aa7d882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,7 @@ return new class extends Migration
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});