Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(drizzle): update schema type & fix issue with default id #10750

Merged
merged 58 commits into from May 8, 2024

Conversation

realmikesolo
Copy link
Contributor

Made tables for adapter optional cause not all of them are used for authentication strategies. Also I exlcuded id from data coming from Authjs in createUser function to enable setting default id as defined in Drizzle table.

☕️ Reasoning

  1. Default id was overwritten by one coming from Authjs;
  2. Not all tables are used for next-auth.

🧢 Checklist

  • Documentation
  • Tests
  • Ready to be merged

realmikesolo and others added 30 commits April 2, 2024 14:38
We would like to have feature parity of Auth.js when hosted either on something like Vercel or in Docker. Moving the docker config to the same example app we host on Vercel and deploying it via Docker will make this easier to verify
…0504)

Update README.md fixed .cts to .cjs

Co-authored-by: Nico Domino <yo@ndo.dev>
@srigi
Copy link

srigi commented Apr 28, 2024

+1 on this, as I'm also not using INT or UUID for PKs in my tables and this would unblock the whole project moving forward.

@ndom91
Copy link
Member

ndom91 commented Apr 30, 2024

Okay nice, looks better to me. Tests all pass as well. @juliusmarminge you want to take one last look over it before I merge it? 🙏

@@ -100,7 +99,7 @@ import type { Adapter } from "@auth/core/adapters"
* userId: text("userId")
* .notNull()
* .references(() => users.id, { onDelete: "cascade" }),
* type: text("type").notNull(),
* type: text("type").$type<AdapterAccount["type"]>().notNull(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can use the new AdapterAccountType introduced in #10832 to avoid circular refernce issues

Copy link
Contributor

@juliusmarminge juliusmarminge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest looks good to me :)

Copy link
Member

@ndom91 ndom91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last thing, lets also update the example(s) in the actual doc page at /docs/pages/getting-started/adapters/drizzle.mdx.

Ideally we wouldn't have two copies of the example setup code. One in the JSDoc in the index.ts and this docs page, but we just migrated to these new docs recently. We'll probably cleanup the schema stuff from the jsdoc shortly.

@JipSterk
Copy link

JipSterk commented May 7, 2024

Do we still want to use AdapterAccount['type'] in the tests?

@ndom91 ndom91 merged commit aecc221 into nextauthjs:main May 8, 2024
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Changes related to the core code concerning database adapters drizzle @auth/drizzle-adapter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants