[PR #5779] [MERGED] fix(adapter): should not apply defaultValue during find calls #6219

Closed
opened 2026-03-13 12:51:26 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5779
Author: @ping-maxwell
Created: 11/5/2025
Status: Merged
Merged: 11/6/2025
Merged by: @himself65

Base: canaryHead: chore/adapter-tests-apply-default-value


📝 Commits (6)

  • 457accf chore(adapter): test default values
  • 15409fe chore: lint
  • dc021be update: make test more advanced
  • 2ecb06c fix: should not apply default value on find
  • 1036c42 Merge branch 'canary' into chore/adapter-tests-apply-default-value
  • 0ccecbe Merge branch 'canary' into chore/adapter-tests-apply-default-value

📊 Changes

2 files changed (+173 additions, -5 deletions)

View changed files

📝 packages/better-auth/src/adapters/tests/normal.ts (+165 -0)
📝 packages/better-auth/src/adapters/utils.ts (+8 -5)

📄 Description

Summary by cubic

Fixes adapter default value handling to apply defaults only during create, never during find, and to not override explicit nulls for non-required fields. Adds tests for user additionalFields and a plugin model to verify testField defaults to "test-value", cbDefaultValueField resolves to "advanced-test-value", IDs are strings, and explicit nulls remain null when retrieved.

Written for commit 0ccecbed48. Summary will update automatically 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/5779 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 11/5/2025 **Status:** ✅ Merged **Merged:** 11/6/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `chore/adapter-tests-apply-default-value` --- ### 📝 Commits (6) - [`457accf`](https://github.com/better-auth/better-auth/commit/457accf42bb612d0e1255ac3413c16e109708afd) chore(adapter): test default values - [`15409fe`](https://github.com/better-auth/better-auth/commit/15409fed4c7a41ec4c5d42aee5af7359f4f78da7) chore: lint - [`dc021be`](https://github.com/better-auth/better-auth/commit/dc021becc5727c13a12859d57464c0b5ed184f60) update: make test more advanced - [`2ecb06c`](https://github.com/better-auth/better-auth/commit/2ecb06c7bb02cca904a4cb6e8359e3f026482998) fix: should not apply default value on find - [`1036c42`](https://github.com/better-auth/better-auth/commit/1036c42a783ef6f9665650d6d0597f2cc0a590a3) Merge branch 'canary' into chore/adapter-tests-apply-default-value - [`0ccecbe`](https://github.com/better-auth/better-auth/commit/0ccecbed4853c676a63af4a4697e2f6639d52a9a) Merge branch 'canary' into chore/adapter-tests-apply-default-value ### 📊 Changes **2 files changed** (+173 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/tests/normal.ts` (+165 -0) 📝 `packages/better-auth/src/adapters/utils.ts` (+8 -5) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Fixes adapter default value handling to apply defaults only during create, never during find, and to not override explicit nulls for non-required fields. Adds tests for user additionalFields and a plugin model to verify testField defaults to "test-value", cbDefaultValueField resolves to "advanced-test-value", IDs are strings, and explicit nulls remain null when retrieved. <sup>Written for commit 0ccecbed4853c676a63af4a4697e2f6639d52a9a. Summary will update automatically 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-03-13 12:51:26 -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#6219