payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
25.57k stars 1.63k forks source link

(db-postgres): `enable_a_p_i_key` column syntax in Users database table #8034

Open joshuaja opened 2 months ago

joshuaja commented 2 months ago

Link to reproduction

https://github.com/DapperMountain/payload-3-bun-template

Environment Info

Binaries:
  Node: 22.2.0
  npm: 10.7.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.0.0-beta.97
  next: 15.0.0-canary.104
  @payloadcms/db-postgres: 3.0.0-beta.97
  @payloadcms/email-nodemailer: 3.0.0-beta.97
  @payloadcms/graphql: 3.0.0-beta.97
  @payloadcms/next/utilities: 3.0.0-beta.97
  @payloadcms/richtext-lexical: 3.0.0-beta.97
  @payloadcms/translations: 3.0.0-beta.97
  @payloadcms/ui/shared: 3.0.0-beta.97
  react: 19.0.0-rc-e56f4ae3-20240830
  react-dom: 19.0.0-rc-e56f4ae3-20240830
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6031
  Available memory (MB): 36864
  Available CPU cores: 14

Describe the Bug

When enabling API Key on a users collection (auth.useAPIKey = true) it creates a few columns in the collection database table. The column naming isn't consistent between the enable_a_p_i_key, api_key, and api_key_index columns. I would recommend changing enable_a_p_i_key to enable_api_key to align with the other column names.

image

Reproduction Steps

  1. Enable API Key on a users collection (auth.useAPIKey = true)
  2. Check the collection database table column names
  3. enable_a_p_i_key would better be named enable_api_key

Adapters and Plugins

db-postgres

joshuaja commented 1 month ago

Looks like this might be related to the to-snake-case npm package. I'm assuming that the variable provided is enableAPIKey which would translate to a rather silly looking enable_a_p_i_key column name in the database.

tansanDOTeth commented 1 month ago

My build was working, but this error started coming up out of no where on my v2 build. Any ideas?