[PR #7171] [MERGED] fix(kysely): edge case aliased joined table names #15366

Closed
opened 2026-04-13 09:59:29 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7171
Author: @ping-maxwell
Created: 1/7/2026
Status: Merged
Merged: 2/28/2026
Merged by: @Bekacru

Base: canaryHead: fix/kysely-joined-edge-case-aliases


📝 Commits (8)

  • d5f5c23 fix(kysely): edge case aliased joined table names
  • 6e762e6 chore: lint
  • d7e5814 Merge branch 'canary' into fix/kysely-joined-edge-case-aliases
  • ffedcba Merge branch 'canary' into fix/kysely-joined-edge-case-aliases
  • d548d26 Merge branch 'canary' into fix/kysely-joined-edge-case-aliases
  • 53d4c9c Merge branch 'canary' into fix/kysely-joined-edge-case-aliases
  • 332598c Merge branch 'canary' into fix/kysely-joined-edge-case-aliases
  • 7a2fce4 Merge branch 'canary' into pr/7171

📊 Changes

1 file changed (+8 additions, -1 deletions)

View changed files

📝 packages/kysely-adapter/src/kysely-adapter.ts (+8 -1)

📄 Description

Closes https://github.com/better-auth/better-auth/issues/6400

There are cases shown in 6400 which leads to aliased fields return capitalized that are derived from underscores defined before the letter. Some models work, others don't.

I'm unsure what causes it but for now I've written comments stating it as an edge case until the true cause is identified.


Summary by cubic

Fix Kysely adapter alias resolution for joined tables to handle capitalized alias keys from snake_case names. Ensures joined fields are mapped correctly and not dropped.

  • Bug Fixes
    • Added fallback match for _Joined{Cap(joinModelRef)}{Cap(fieldName)} alongside _joined_{joinModelRef}_{fieldName}.
    • Imported capitalizeFirstLetter to normalize alias comparison.

Written for commit 332598c9db. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7171 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 1/7/2026 **Status:** ✅ Merged **Merged:** 2/28/2026 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/kysely-joined-edge-case-aliases` --- ### 📝 Commits (8) - [`d5f5c23`](https://github.com/better-auth/better-auth/commit/d5f5c235ff39a299da9c40da367282c3b8897a8d) fix(kysely): edge case aliased joined table names - [`6e762e6`](https://github.com/better-auth/better-auth/commit/6e762e61f4156ae783bb53e498d011ff552badd4) chore: lint - [`d7e5814`](https://github.com/better-auth/better-auth/commit/d7e581439341de3b12ba6f56826bfe3399f20947) Merge branch 'canary' into fix/kysely-joined-edge-case-aliases - [`ffedcba`](https://github.com/better-auth/better-auth/commit/ffedcba59f5480d81c9f509dcce35f7bc6d60d2a) Merge branch 'canary' into fix/kysely-joined-edge-case-aliases - [`d548d26`](https://github.com/better-auth/better-auth/commit/d548d26e5a0b4694f14687f7cdba8080957501f9) Merge branch 'canary' into fix/kysely-joined-edge-case-aliases - [`53d4c9c`](https://github.com/better-auth/better-auth/commit/53d4c9c6c1a19ae1c1d0981875d49830d6addc55) Merge branch 'canary' into fix/kysely-joined-edge-case-aliases - [`332598c`](https://github.com/better-auth/better-auth/commit/332598c9db43b2db7fe66b3354b94c98d546c2cc) Merge branch 'canary' into fix/kysely-joined-edge-case-aliases - [`7a2fce4`](https://github.com/better-auth/better-auth/commit/7a2fce49b57afc005125907c4470bb8a92044ce6) Merge branch 'canary' into pr/7171 ### 📊 Changes **1 file changed** (+8 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/kysely-adapter/src/kysely-adapter.ts` (+8 -1) </details> ### 📄 Description Closes https://github.com/better-auth/better-auth/issues/6400 There are cases shown in [6400](https://github.com/better-auth/better-auth/issues/6400) which leads to aliased fields return capitalized that are derived from underscores defined before the letter. Some models work, others don't. I'm unsure what causes it but for now I've written comments stating it as an edge case until the true cause is identified. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fix Kysely adapter alias resolution for joined tables to handle capitalized alias keys from snake_case names. Ensures joined fields are mapped correctly and not dropped. - **Bug Fixes** - Added fallback match for `_Joined{Cap(joinModelRef)}{Cap(fieldName)}` alongside `_joined_{joinModelRef}_{fieldName}`. - Imported capitalizeFirstLetter to normalize alias comparison. <sup>Written for commit 332598c9db43b2db7fe66b3354b94c98d546c2cc. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 09:59:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#15366