next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

docs(pg-adapter): add unique and foreign key constraints to the PG adapter schema

Open baptiste00001 opened this issue 1 year ago • 6 comments

☕️ Reasoning

The contraints in the PG adapter schema are non existant while they are defined in all other adapters. I added them to the schema.

🧢 Checklist

  • [X] Documentation
  • [X] Tests
  • [X] Ready to be merged

baptiste00001 avatar Dec 14 '24 10:12 baptiste00001

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 22, 2024 9:57am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Dec 22, 2024 9:57am

vercel[bot] avatar Dec 14 '24 10:12 vercel[bot]

@baptiste00001 is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Dec 14 '24 10:12 vercel[bot]

Ah wait, we may need to remove the unique constraint on email. Will that fail if we try to use null for multiple users email?

ndom91 avatar Dec 19 '24 07:12 ndom91

Ah wait, we may need to remove the unique constraint on email. Will that fail if we try to use null for multiple users email?

It works fine with null value for multiple users email because there is no NULL NOT DISTINCT after the UNIQUE constraint. So two null values are considered distinct. I just tested it.

I think email should probably be unique in most cases, but feel free to remove the unique constraint if you think it fits the broader use cases. In my use case I need to have email as unique so I added it.

baptiste00001 avatar Dec 19 '24 08:12 baptiste00001

I approved the test run from fork to ensure the pg schema still works. It ran into a few prettier issues. ~I know one isn't from a file in your PR, but would you mind running prettier over these here? :pray:~

~See: https://github.com/nextauthjs/next-auth/actions/runs/12443333045/job/34755721579?pr=12381~

EDIT: Neverind, fixed it here

ndom91 avatar Dec 22 '24 00:12 ndom91

I approved the test run from fork to ensure the pg schema still works. It ran into a few prettier issues. ~I know one isn't from a file in your PR, but would you mind running prettier over these here? 🙏~

~See: https://github.com/nextauthjs/next-auth/actions/runs/12443333045/job/34755721579?pr=12381~

EDIT: Neverind, fixed it here

Oh OK I actually fixed it as well and commited. It was a bunch of extra spaces that needed to be removed in two files. I hope you can merge the PR now. If you need anything else just ask me.

baptiste00001 avatar Dec 22 '24 09:12 baptiste00001