From d3da820a6a402aa2ec449378f14f32fcd7473828 Mon Sep 17 00:00:00 2001 From: iv-craig Date: Sun, 3 Sep 2023 03:32:25 -0400 Subject: [PATCH] fix: define index prefix length for MySQL (#431) --- database/migrations/2019_03_29_163611_add_webauthn.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/database/migrations/2019_03_29_163611_add_webauthn.php b/database/migrations/2019_03_29_163611_add_webauthn.php index 43e1931..6c2ef70 100644 --- a/database/migrations/2019_03_29_163611_add_webauthn.php +++ b/database/migrations/2019_03_29_163611_add_webauthn.php @@ -1,6 +1,8 @@ timestamps(); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - $table->index('credentialId'); + + if (app(Resolver::class)->connection($this->getConnection()) instanceof MySqlConnection) { + $table->index([app('db')->raw('credentialId(255)')], 'credential_index'); + } else { + $table->index('credentialId'); + } }); }