diff --git a/database/migrations/2024_05_03_100000_update_webauthn_keys.php b/database/migrations/2024_05_03_100000_update_webauthn_keys.php new file mode 100644 index 00000000000..b5bd698f477 --- /dev/null +++ b/database/migrations/2024_05_03_100000_update_webauthn_keys.php @@ -0,0 +1,36 @@ +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(); + } + }); + } +};