Commit Graph
59 Commits
Author SHA1 Message Date
rovertrackGitHubcubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
09162d3d12 feat(prisma): enhance JSON default value handling for arrays and objects in schema generation (#5904)
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-11-11 18:21:03 +00:00
MaxwellandGitHub 705f7434c7 fix: treat generateId "serial" as numeric ID and correct UUID column types across adapters (#5823) 2025-11-11 18:04:24 +00:00
af6ebfe879 feat: auto-index CLI (#5357)
Co-authored-by: Bereket Engida <Bekacru@gmail.com>
2025-11-10 14:12:48 -08:00
Alex YangandGitHub 938c2a7c31 chore: lint enable organize import (#5556) 2025-10-24 19:05:09 +00:00
Eniola OsabiyaandGitHub 03fbf937db fix(drizzle): replace pgEnum with text enum type in Drizzle schema generation (#5408) 2025-10-19 01:29:51 +00:00
Alex YangandGitHub f0957337e3 chore(cli): improve type (#5374) 2025-10-17 20:32:00 +00:00
Alex YangandGitHub fd780aca6b feat: enum support for drizzle schema (#5287) 2025-10-13 23:56:39 +00:00
MaxwellandGitHub 4b136408ab fix(adapter): missing data type transformation on where clauses (#5158) 2025-10-12 04:12:33 +00:00
MaxwellandAlex Yang 0a1df9e43f chore: fix adapter tests (#4844) 2025-09-30 10:14:23 -07:00
zy1pandAlex Yang 981458338d fix(cli): timestamp in schema for Drizzle with SQLite (#4622) 2025-09-29 19:34:08 -07:00
Alex YangandGitHub 30fa5fc0d2 refactor: move db schema to core (#4918) 2025-09-26 08:11:10 +00:00
Alex YangandGitHub 831dd1d64e fix(cli): defaultNow is deprecated in schema for Drizzle with SQLite (#4889) 2025-09-25 22:33:03 +00:00
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
YurinandGitHub 80b733d513 fix(prisma): handle optional field relation types correctly (#4630) 2025-09-13 19:11:51 +00:00
AajeethandGitHub 589634d475 fix: correct MongoDB adapter import path in CLI (#4602) 2025-09-12 23:36:44 +00:00
Phips PeterandGitHub f2c9df4811 feat(sqlite): remove autoincrement for SQLite (#4466) 2025-09-08 17:23:00 -07:00
Alex YangandGitHub a6ba8ac068 fix(db): special case schema generation ID (#4400) 2025-09-03 13:40:54 -07:00
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 YangandGitHub c84b37faaf feat: add @default and @updatedAt for prisma generator (#4375) 2025-09-02 21:22:08 -07:00
TaesuandGitHub df6151d161 fix(cli): simplify and correct comma insertion logic in plugin array (#4281) 2025-08-29 11:40:39 -07:00
Alex YangandGitHub 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
MaxwellandGitHub 5d84a76a54 fix(cli): Incorrect drizzle schema gen (#4132) 2025-08-23 18:18:10 -07:00
Eniola OsabiyaandGitHub 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 TarikuandBereket Engida 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
Ben AgnewandGitHub 0d16d8e02c fix(cli): incorrect api for auto increment in drizzle schema generation(#3940) 2025-08-11 17:37:52 -07:00
KinfeMichael TarikuandBereket Engida 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
Fraol LemechaandGitHub 2481c1d575 fix(cli): only show the overwrite message when the schema file exists and the code has changed (#3826) 2025-08-06 11:01:19 -07:00
Alex YangandGitHub 575070f605 chore: bump biome (#3784) 2025-08-04 13:48:54 -07:00
Bereket EngidaandGitHub 847fc9bfda feat(drizzle): support camel case schema generation (#2550) 2025-07-18 10:39:16 -07:00
KinfeMichael TarikuandGitHub 15452a5402 fix: mysql foreign key constraints on generate (#2828)
* fix: mysql foreign key constraints

* lint

* clean up

* clean up

* lint
2025-07-17 09:58:52 -07:00
AbdallahandGitHub 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 TarikuandGitHub 6444c0498e fix(cli): format drizzle schema output (#3244) 2025-07-02 13:45:03 -07:00
AbbasandGitHub 12e15cce41 fix(drizzle-cli): use serial as PK when useNumberId is enabled (#3228) 2025-06-30 18:36:23 -07:00
Tai VoandGitHub 552ea8a041 feat(cli): allow cli to use custom adapter createSchema if implemented (#3006)
* the cli now uses createSchema from custom adapters

* rename function misnomer and keep old name as deprecated
2025-06-13 16:59:00 -07:00
KinfeMichael TarikuandGitHub 90cd37caee fix: remove empty migration with semi colon (#2927) 2025-06-06 22:15:32 -07:00
AlexandGitHub e7aec18d7d chore: missing quotes for drizzle default values 2025-05-16 10:02:43 -07:00
Muntasir MahmudandGitHub d914650289 chore: clean up minor typo mistakes 2025-05-14 10:27:58 -07:00
KinfeMichael TarikuandGitHub af402dba3a fix: add a default value for generated fields 2025-05-02 00:29:32 +03:00
MaxwellandGitHub c6eb16e626 fix(cli): schema gen with Drizzle for PG to generate text instead of uuid (#2248) 2025-04-13 14:30:16 +03:00
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
Paul NodetandGitHub 43ab2860b4 fix(cli): invalid prisma init config (#1964) 2025-03-24 08:03:20 +03:00
occoruneandGitHub ab52426c01 cli(fix): correct typo in auth-config for DrizzleAdapter (#1950) 2025-03-23 08:42:33 +03:00
8e47f11298 fix(init-cmd): Dependencies do not install if ENVs are skipped (#1603)
* fix(cli): init cmd types

* fix(init): deps do not install if env is skipped

- also made the CLI show which packages it will install

* fix(typecheck): specify tsconfig for declarations

---------

Co-authored-by: Bereket Engida <bekacru@gmail.com>
2025-03-01 11:03:56 +03:00
c66fdc9129 feat: init Better Auth CLI command (#1427)
* update: init command now can do plugins & DB generation

* fix: revert nextjs auth.ts file

* add: pacakge @clack/prompts for better CLI experience

* update: moved from prompts to clack/prompts

* add: functionality to hide logs coming from `getConfig`

* remove: hide logs functionality

* chore: remove unneeded import

* add: install dependencies feature

* add: functionality to update/install better-auth

* fix: install/upgrade better-auth deps

* add: spinner during version checking

* fix: nextCookies plugin import path

* fix: oidc plugin contents

* update: emoji-ify

* fix: mysql code

* refactor: logging/prompt style

* update: mysql use 1 ENV

* fix: msql, revert back to old code

* fix: mysql connectionUri, again

* fix: missing sqlite env

* fix: added back the plugins multiselect

* update: outro text

* add: ENV generation for `BETTER_AUTH_URL` & `BETTER_AUTH_SECRET`

* update: intro & outro text, plus some ENV default values

* remove: name from cli options

* fix: made index.ts's getPackageInfo not crash the program entirely if ENOENT

* update: prompt to get auth config dir if not auto found

* fix: create auth config file

* add: log to state the new file that's being created

* update: outro text

* fix: unneeded diff display

* add: auth-client creator

* fix: auth-client plugins are now grouped

* fix: auth-client import path bugs

* fix: invalid client plugins

* fix: oneTap client plugin contents

* update: allow getConfig to throw errors instead of logging

* fix: auth config error logging

* WIP: auth client code gen

* chore: linter

* update: now supports auth client generation

* WIP: grouped imports

* remove: functionality to update existing auth code

* add: functionality to update tsconfig

* fix: tsconfig not saving new updated values

* fix: handle missing .env files in init process

* update: made `no env file found` error message use `outro` for better logging experience

* fix: removed `ms` at the end as the `formatMilliseconds` fn already handles that

* update: move ENV code after plugins initialization

* chore: update pnpm lockfile and remove deprecated package note

* chore: lint

---------

Co-authored-by: Bereket Engida <bekacru@gmail.com>
2025-03-01 00:33:14 +03:00
Greg JacksonandGitHub f011c741e6 fix(cli): add on delete cascade constraint to drizzle references (#1419) 2025-02-12 08:39:00 +03:00
81936d756a fix(cli): wrong kysely schema filename (#1366)
Co-authored-by: Alfan Jauhari <alfan@zero-one-group.com>
2025-02-06 15:09:51 +03:00
Bereket Engida d2ce9da9b2 chore: lint 2025-01-16 13:07:34 +03:00
Ammar ElbeheryandGitHub bde1407b15 cli(fix): add bigint type to generators (#1217) 2025-01-16 12:29:46 +03:00
Bereket EngidaandGitHub bfc8f15aad fix(drizzle): default to snake-case (#1012) 2024-12-24 13:04:14 +03:00
Bereket EngidaandGitHub 0aaa573a32 fix(drizzle): it should use text for id fields other than mysql (#719) 2024-12-02 12:26:43 +03:00