Commit Graph

60 Commits

Author SHA1 Message Date
Alex Yang
fd780aca6b feat: enum support for drizzle schema (#5287) 2025-10-13 23:56:39 +00:00
Alex Yang
fe01f5ef11 chore: use tsdown as bundler (#5249) 2025-10-13 17:35:33 +00:00
Maxwell
4b136408ab fix(adapter): missing data type transformation on where clauses (#5158) 2025-10-12 04:12:33 +00:00
Kyle Roach
fc32113a00 feat(organization): support createdAt on invitations (#2346)
Co-authored-by: Alex Yang <himself65@outlook.com>
2025-10-06 17:44:38 +00:00
Taesu
0581a66272 fix: add required constraint to slug filed in org plugin (#4989) 2025-09-30 13:27:47 -07:00
Maxwell
0a1df9e43f chore: fix adapter tests (#4844) 2025-09-30 10:14:23 -07:00
zy1p
981458338d fix(cli): timestamp in schema for Drizzle with SQLite (#4622) 2025-09-29 19:34:08 -07:00
Alex Yang
831dd1d64e fix(cli): defaultNow is deprecated in schema for Drizzle with SQLite (#4889) 2025-09-25 22:33:03 +00:00
Gabriel Lima
20e87a2e1c fix(cli): add missing JSON type to schema generation (#4494)
Co-authored-by: KinfeMichael Tariku <65047246+Kinfe123@users.noreply.github.com>
2025-09-14 13:27:13 -07:00
Phips Peter
f2c9df4811 feat(sqlite): remove autoincrement for SQLite (#4466) 2025-09-08 17:23:00 -07:00
Alex Yang
a6ba8ac068 fix(db): special case schema generation ID (#4400) 2025-09-03 13:40:54 -07:00
Evan
9fb9bd92f8 feat: use defaultNow() for drizzle timestamp fields (#3873)
Co-authored-by: Alex Yang <himself65@outlook.com>
2025-09-03 08:13:06 -07:00
Alex Yang
77042b4a8d fix: add missing defaultValue on core schema (#4374) 2025-09-03 00:15:16 -07:00
Alex Yang
c84b37faaf feat: add @default and @updatedAt for prisma generator (#4375) 2025-09-02 21:22:08 -07:00
Taesu
df6151d161 fix(cli): simplify and correct comma insertion logic in plugin array (#4281) 2025-08-29 11:40:39 -07:00
Alex Yang
878de4e524 test: fix directory not exist (#4271) 2025-08-27 13:16:16 -07:00
Alex Yang
7931166c8d feat(cli): add info script (#4143) 2025-08-27 10:49:34 -07:00
Alex Yang
240ef3d20e feat: add onUpdate field on db schema generation (#4241)
Fixes: https://github.com/better-auth/better-auth/issues/4187
2025-08-26 15:28:20 -07:00
Maxwell
5d84a76a54 fix(cli): Incorrect drizzle schema gen (#4132) 2025-08-23 18:18:10 -07:00
Alex Yang
bb634a0f5c fix(cli): generate throws error with default export (#4113) 2025-08-20 16:25:32 -07:00
Eniola Osabiya
d9f8806090 fix(cli): check for undefined defaultValue instead of truthy value when generating drizzle schema(#3512) 2025-08-20 09:35:44 -07:00
KinfeMichael Tariku
9a6a8d741b feat(cli): support sveltekit $ imports in CLI generate cmd (#4042)
* sync

* lint

* sync

* sync

* lint
2025-08-17 01:11:27 -07:00
Erick Christian
c5d10fda64 feat(cli): resolves tsconfig references for path aliases (#3764)
* feat(cli): resolves tsconfig references for path aliases

Previously references field was ignored and path aliases were only taken
from main tsconfig file

* chore: generate changeset

* test(cli): config is loaded correctly with alias

* chore: remove changeset

---------

Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com>
Co-authored-by: KinfeMichael Tariku <65047246+Kinfe123@users.noreply.github.com>
2025-08-16 09:34:50 -07:00
KinfeMichael Tariku
1993317251 fix(cli): clean up unused pg and mysql import in drizzle schema generator (#3974)
* fix(cli): clean up unused pg import in schema generator

* sql clean up

* clean up
2025-08-14 18:35:26 -07:00
KinfeMichael Tariku
1cbea683d8 fix(cli): add FK onDelete cascade and CURRENT_TIMESTAMP defaults on generation (#3906)
* fix(db): add FK onDelete (cascade) and CURRENT_TIMESTAMP defaults for date columns

* default generate

* console

* update
2025-08-13 18:13:01 -07:00
KinfeMichael Tariku
4c4c259a54 fix(cli): prisma schema generate mismatch on custom plugin table names (#3021)
* fix: generate mismatch

* clean up

* linkt

* lint

* clean up

* clean up

* lint

* lint

* test

* clean up

* clean up

* lint

* update
2025-08-06 16:38:50 -07:00
Bereket Engida
56bd676534 Merge branch 'main' into v1.3 2025-07-17 10:08:46 -07:00
Abdallah
e02c28115d fix: schema generation when using advanced.databse.useNumberId (#3311)
* fix: schema generation when using advanced.databse.useNumberId

* fix: ci test
2025-07-17 09:06:21 -07:00
KinfeMichael Tariku
4cff983e5c refactor: migrated all packages from Zod v3 to Zod v4 (#3399)
Refactors
- Updated all imports and type references to use zod/v4.
- Replaced deprecated or changed Zod APIs and options across the codebase.
- Adjusted validation schemas and error messages to match Zod v4 requirements.
- Updated dependencies and lockfiles to use Zod v4.
2025-07-17 08:30:02 -07:00
KinfeMichael Tariku
6444c0498e fix(cli): format drizzle schema output (#3244) 2025-07-02 13:45:03 -07:00
Abbas
12e15cce41 fix(drizzle-cli): use serial as PK when useNumberId is enabled (#3228) 2025-06-30 18:36:23 -07:00
KinfeMichael Tariku
af402dba3a fix: add a default value for generated fields 2025-05-02 00:29:32 +03:00
Maxwell
c6eb16e626 fix(cli): schema gen with Drizzle for PG to generate text instead of uuid (#2248) 2025-04-13 14:30:16 +03:00
Maxwell
986614b241 feat: createAdapter and useNumberId (#1926)
* refactor(adapter): `createAdapter` helper

* update: Kysely adapter support

* update: memory adapter

* chore: cleanup

* update: MongoDB adapter supported

* update: mongodb adapter file names

* update: support for prisma adapter

- also fixed memory adapter with `getField`
- disabled all debug logs by default

* chore: lint

* fix: generate an `id` if it isn't already provided

* update(test): init config snapshot

* update: existing adapters tests to include an `id` existence check

* fix: renamed prisma adapter file names

* ^

* update(mongo): Removed `disableIdGeneration` for mongo adapter

* fix: dont add `id` from fields if `disableIdGeneration` is false

* fix: adapter converting dates to string using the wrong value data

* add: create-adapter tests

* update: moved `adapter` to `create-adapter` under the existing `adapters` folder

* WIP: docs

* fix: create-adapter test importing from wrong path

* WIP: docs

* update: key transformation map options are now objs not fns

* chore: lint

* update: cleanup & added debugLogs/usePlural option to some adapters

* update: tests

* chore: cleanup

* update: fields name & made customTransforminput/output to run after supportsDates/supportsBoolean/SupportsJSON to run

* chore: lint

* Update: docs

* update: update-many to not use transformOutput

* chore: lint

* fix: adapter options breaking

* update: set the default limit on findMany

* update: docs

* update: docs & cleaned up code

* update: create schema comes with `tables` now

* This is useless

* fix: api-key shouldn't handle id gen in row creation

* chore: lint

* WIP: useNumberId

* chore: cleanup

* removed all cases of `id` during adapter.create call

* update: useNumberId

* update: drizzle adapter schema generation

- update: pg now sets `id` field to use `uuid`.
- fix: sets the correct reference `onDelete` action.
- refactor: cleaned up the code a lot more

* update: added `supportNumericIds` in create adapter options

* chore: cleanup

* update(tests): added option to disable any adapter tests & created a `useNumberId` test

* fix: skip tests options were using old method

* chore: lint

* WIP: Drizzle tests with number id

* chore: lint

* fix: memory adapter failing on number id adapter tests

* chore: cleanup

* fix: adapter tests fail due to emails needing to be unique

* update: support drizzle adapter use-number-id

* fix: cleanup Drizzle Adapter tests

* fix: drizzle schema generation for reference id fields

* fix: type errs in memory adapter tests

* fix: memory adapter tests

* Update init.test.ts.snap

* fix: prisma tests correctly uses the right primsa client per schema

* Delete run-vitest.ts

* update: create-adapter to support `getDefaultFieldName`

* update: create-adapter adapter options updated

* fix: adapters using older function names

* fix: create-adapter now converts where clauses & added tests

* update: new `getFieldAttributes` option in create-adapter, and fixed convert where clause fn

* chore: cleanup

* update: convertWhereClause in create-adapter improved

* update: BAOptions to start using `database` & updated adapter tests

* fix: type errors

* chore: lint

* update: default config values for the create-adapter config

* fix: getModelName doesnt take into account of plural

* chore: cleanup

* update: improved getDefaultModelname

* fix: create-adapter transform input doesn't take into account reference IDs

* fix: transformInput on reference IDs doesn't take into account of array IDs

* chore: lint

* fix: prisma tests

* fix: Prisma adapter tests running one after another

* fix: init snapshot should state supportJSON as `false`

* fix: drizzle adapter tests

* update: adapter test options to allow passing a test prefix

* chore: add state.txt to gitignore

* remove: state.txt from gitignore, it's useless

* chore: lint

* Update adapter.prisma.numberid.test.ts

* fix: get-migration for mysql & mssql `id` fields to use varchar

* chore: cleanup

* update: adapter comes with adapter-test-debug-log functions

* update: made adapterTestDebugLog functions only be in adapter if config enabled it

* fix: transactionId for debug logs not working correctly

This was due to the adapter being reinitialized each test case

* update: Added colors to debug logs

* update: adapter tests a little more refined

* add: deepmerge dev deps to deep merge better auth options config for adapters

* fix: create-adapter types

* update: revert back to old types

* fix: prisma adapter tests now run one after another

* fix: kysely adapter to work when no `id` is provided

* update: mongoDB to set `supportNumericids` to false

* update(docs): discuss new `database` object in BetterAuthOptions

* add: support for custom ID generation

* fix: docs had incorrect default value for `supportsJSON`

* update(docs): added number id adapter test documentation

* fix: drizzle-adapter mysql tests

* update: drizzle-adapter tests to use deepmerge

* add: drizzle-adapter mysql tests to test useNumberId

* add: Prisma generate to support number id

* update: support the old `generateId` option, but warn the user for deprecation

* update: init test snapshot

* update: adapter tests not included in normal tests

* Update pnpm-lock.yaml

* fix: typo in file names for kysley test files

* update: separated adapter tests

* Update pnpm-lock.yaml

* fix: please tell me I actually fixed this

* fix: pnpm-lock merge conflict

* chore: lint

* fix: sveltekit pkg.json merge conflicts (hopefully)

* Delete pnpm-lock.yaml

* update: createSchema takes into account of rate-limit and secondaryStorage

* improve docs

* add drizzle returning id retriver

* chore: fix test script

---------

Co-authored-by: Bereket Engida <bekacru@gmail.com>
2025-04-11 09:04:49 +03:00
Bereket Engida
b5f638ca45 docs: upgrade to tailwind v4, react 19, fuma docs 15 (#1735) 2025-03-08 19:33:31 +03:00
Bereket Engida
7ba1af2ff9 Merge branch 'main' into v1.2 2025-02-27 14:20:23 +03:00
PitonsSkipper
1ecc717483 fix: add last semi-colon to the compiled migrations to support Cloudflare D1 migration (#1569)
* Update get-migration.ts

Add last semi-colon to the compiled migrations

* Update test snapshot migrations.sql
2025-02-25 12:12:02 +03:00
Bereket Engida
2c81e5bf8f Merge branch 'main' into v1.2 2025-02-14 15:17:41 +03:00
Bereket Engida
047d677966 feat: support stroring dispaly username to store un-normalized username (#1204)
* feat: support stroring dispaly username to store un-normalized username

* test: update snapshot
2025-02-14 12:33:24 +03:00
Greg Jackson
f011c741e6 fix(cli): add on delete cascade constraint to drizzle references (#1419) 2025-02-12 08:39:00 +03:00
KinfeMichael Tariku
0794de2c71 fix(drizzle): drizzle with mysql update breaks on anything other than update by id(#1377)
---------

Co-authored-by: Bereket Engida <bekacru@gmail.com>
2025-02-08 11:11:37 +03:00
Bereket Engida
db4b4fce40 feat: support .js config (#1256) 2025-01-21 14:19:34 +03:00
Bereket Engida
bfc8f15aad fix(drizzle): default to snake-case (#1012) 2024-12-24 13:04:14 +03:00
Bereket Engida
0eacf0182d refactor: standardize how session and user data is returend in endpoints (#968) 2024-12-21 01:58:35 +03:00
Bereket Engida
92e249139f chore: fix cli snapshot 2024-12-20 23:00:16 +03:00
Marc Mogdanz
8dffaa2cd6 docs: use APIRoute instead of Route for tanstack start api routes (#943)
* fix(docs): use `APIRoute` instead of `Route` for tanstack start api routes

* fix(cli): remove unused import in drizzle schema
2024-12-20 20:59:52 +03:00
Bereket Engida
cc1666d92d docs: add section on how to use error codes 2024-12-08 14:30:24 +03:00
Bereket Engida
0aaa573a32 fix(drizzle): it should use text for id fields other than mysql (#719) 2024-12-02 12:26:43 +03:00
Bereket Engida
ee705a5f26 fix: prisma schema generator should add @db.text for mysql and generate many fields (#718) 2024-12-02 12:01:54 +03:00
Bereket Engida
783378458d chore: update snapshot 2024-11-29 20:32:19 +03:00