Skip to content

Commit

Permalink
fix: fix webauthn keys (#7261)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin committed May 3, 2024
1 parent 343495f commit 50c266f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions database/migrations/2024_05_03_100000_update_webauthn_keys.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use Illuminate\Database\Migrations\Migration;
use LaravelWebauthn\Models\WebauthnKey;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
WebauthnKey::select(['id', 'credentialId'])->chunk(200, function ($keys) {
foreach ($keys as $key) {
$key->update(['credentialId' => $key->credentialId]);
}
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
WebauthnKey::select(['id', 'credentialId'])->chunk(200, function ($keys) {
foreach ($keys as $key) {
$key->setRawAttributes(['credentialId' => base64_encode($key->credentialId)]);
$key->save();
}
});
}
};

0 comments on commit 50c266f

Please sign in to comment.