fix: no user ever had a username, so people search found nobody

Root cause of "still cannot find users": username was optional in
better-auth's schema and no signup form or settings page ever set it,
but search/profile/follow all key on username, not user id. Every
account now gets a unique one auto-generated (from name/email) in the
user.create.before hook — covers email/password and OAuth signups.
Added a one-off db:backfill-usernames script for accounts created
before this fix and ran it against the current database.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Arnaud
2026-07-13 17:26:12 +02:00
parent 79cdb8cd04
commit 2ee99ea463
8 changed files with 112 additions and 5 deletions
+2 -1
View File
@@ -1,6 +1,6 @@
{
"name": "epicure",
"version": "0.13.0",
"version": "0.13.1",
"private": true,
"scripts": {
"dev": "pnpm --filter web dev",
@@ -10,6 +10,7 @@
"db:generate": "pnpm --filter @epicure/db generate",
"db:migrate": "pnpm --filter @epicure/db migrate",
"db:seed": "pnpm --filter @epicure/db seed",
"db:backfill-usernames": "pnpm --filter @epicure/db backfill-usernames",
"db:studio": "pnpm --filter @epicure/db studio"
},
"devDependencies": {