Laravel 11: questionable default indexes on table password_reset_tokens
#51001
Unanswered
MircoBabin
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version
11.2
PHP Version
8.2.16
Database Driver & Version
10.4.33-MariaDB-cll-lve
Description
The
password_reset_tokens
table has a primary key onemail
and no index ontoken
. Which is a questionable default ( see https://github.com/laravel/laravel/blob/11.x/database/migrations/0001_01_01_000000_create_users_table.php ):token
?token
not the primary key? Because I would expect token to be unique and very hard guessable.InnoDB
not explicitly set as the default engine? Nowadays MySql 5.6 and MariaDB 10.2 useInnoDB
as default storage engine. But of course my internet provider may have changed the default. Looking into the sources I foundvendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
which does explicitly setInnoDB
engine. So there is a precedent for explicitly usingInnoDB
and thereby ruling out other non-transactional engines likeMyIsam
.Looking back in a Laravel 4.2 project, back in the day (not by me, but by my predecessor) the then called table
password_reminders
was created with2014_05_26_142727_create_password_reminders_table.php
. And had no primary key, just 2 indexes onemail
andtoken
.Steps To Reproduce
Run
php artisan migrate
after a fresh Laravel 11 installation. This time updated against the latest skeleton.Beta Was this translation helpful? Give feedback.
All reactions