diff --git a/composer.lock b/composer.lock index d1c8898..ee3c7ed 100644 --- a/composer.lock +++ b/composer.lock @@ -670,7 +670,7 @@ "dist": { "type": "path", "url": "../keyring", - "reference": "dcc4dc4f50027bb596f462852d88b2b674fd1af4" + "reference": "639d3059efe34e1daea49ad13b52415c5ee7dd58" }, "require": { "bacon/bacon-qr-code": "^3.0", diff --git a/database/migrations/2026_11_11_200000_add_keyring_session_user_type.php b/database/migrations/2026_11_11_200000_add_keyring_session_user_type.php new file mode 100644 index 0000000..410c61a --- /dev/null +++ b/database/migrations/2026_11_11_200000_add_keyring_session_user_type.php @@ -0,0 +1,49 @@ +string('user_type')->nullable()->after('user_id'); + }); + + // This app has one user model, so every session so far is one of + // its users' and nobody has to sign in again. + DB::table('keyring_sessions')->update(['user_type' => RegisteredSession::typeOf(new User)]); + + Schema::table('keyring_sessions', function (Blueprint $table) { + $table->string('user_type')->nullable(false)->change(); + $table->dropIndex(['user_id']); + $table->index(['user_type', 'user_id']); + }); + + // A reserved address is folded further now ("ß" and a doubled "s" + // are found as each other), so the hash it's found by is made again. + PendingChange::query()->whereNotNull('previous_value')->each( + fn (PendingChange $change) => $change->forceFill(['previous_value_hash' => PendingChange::lookupHash($change->previous_value)])->saveQuietly(), + ); + } + + public function down(): void + { + Schema::table('keyring_sessions', function (Blueprint $table) { + $table->dropIndex(['user_type', 'user_id']); + $table->dropColumn('user_type'); + $table->index('user_id'); + }); + } +};