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

feat(dbAuth): Prompt for creating User model #10849

Merged
merged 14 commits into from
Jun 19, 2024

Conversation

Tobbe
Copy link
Member

@Tobbe Tobbe commented Jun 18, 2024

Add support for passing --createUserModel (or just -u) to yarn rw setup auth dbAuth.
Also adds a prompt for creating the user model

If a User model already exists:

  • The user will not be prompted to create one
  • If -u is passed together with -f, another User model will be crated (so now there'll be two)
  • If -u is passed without force setup will fail

@Tobbe Tobbe added the release:feature This PR introduces a new feature label Jun 18, 2024
@Tobbe Tobbe added this to the next-release milestone Jun 18, 2024
@cannikin
Copy link
Member

  • Should we include createdAt and updatedAt columns? Especially for User those seem like very handy columns to have in there by default
  • Docs?

@Tobbe
Copy link
Member Author

Tobbe commented Jun 18, 2024

  • Should we include createdAt and updatedAt columns? Especially for User those seem like very handy columns to have in there by default

I updated to model to look like this now. Is this what you had in mind?

model User {
  id                  Int       @id @default(autoincrement())
  createdAt           DateTime @default(now())
  updatedAt           DateTime @updatedAt
  email               String    @unique
  hashedPassword      String
  salt                String
  resetToken          String?
  resetTokenExpiresAt DateTime?
}
  • Docs?

I looked at our current docs, and we didn't really list cli options or anything like that from what I could tell. And I also figured it'd be pretty self documenting in that you'd be prompted when you run the setup command. So ultimately I decided no docs were needed.

@cannikin
Copy link
Member

Nice! Not to be a nitpicker, but I always put them at the end of the list: Prisma will create them in the order you define them, and when you go to your DB in a GUI it's nice that they're at the end of the table—you don't have to always scroll past them to get to the data you actually care about (email, etc)

@Tobbe
Copy link
Member Author

Tobbe commented Jun 18, 2024

I always put them at the end of the list

Done

@Tobbe Tobbe merged commit ded3d74 into redwoodjs:main Jun 19, 2024
51 checks passed
@Tobbe Tobbe deleted the tobbe-dbauth-create-user-model branch June 19, 2024 00:36
@Tobbe Tobbe changed the title feat(dbAuth): Prompt for creating User table feat(dbAuth): Prompt for creating User model Jun 22, 2024
@Josh-Walker-GM Josh-Walker-GM modified the milestones: next-release, v8.0.0 Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature This PR introduces a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants