Skip to content

chore(be): modify schema#23

Open
zero1177 wants to merge 2 commits intomainfrom
chore/modify-schema
Open

chore(be): modify schema#23
zero1177 wants to merge 2 commits intomainfrom
chore/modify-schema

Conversation

@zero1177
Copy link

@zero1177 zero1177 commented Mar 19, 2026

변경 사항

better-auth 사용을 위한 schema 변경

User 테이블의 id를 기존 Int 대신 String으로 써야 한다고 합니다..!! (better-auth는 UUID를 기본값으로 사용)
그래서 userIndex 필드를 별도로 둬서 기존 auto-increment를 사용할 수 있도록 해야 할거 같아요
기존 user.Id를 참조하는 다른 로직들은 userIndex를 참조하도록 변경해야 할것 같습니다

@zero1177 zero1177 self-assigned this Mar 19, 2026
Copy link
Contributor

Choose a reason for hiding this comment

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

better-auth 구현 형 정말 고생했어요!!

그런데 저 궁금한 점이 있습니다!! 물론 이제 저도 이 라이브러리를 처음 알게 된거라 장수님이 보내주신 레딧과 도현이가 알려준 UUID를 정말 많이 참고하고, 제미나이로 공부한거라 틀린 부분이 있을 수 있어서 꼭 다른 분들의 더블체크가 있었으면 합니다!!

@RyuRaseul @hjkim24

근데 개인적으로 궁금한건데 어느순간부터 깃허브에 @ 태그 걸면 코파일럿 말고 클로드코드도 같이 뜨더라고요. 이거 클로드코드도 깃허브 내에서 자동 PR 되나요?

token String @unique
ipAddress String?
userAgent String?
userId Int
Copy link
Contributor

Choose a reason for hiding this comment

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

여기서 현재 상태로는 user.id랑 타입 충돌이 날 것 같아요 마이그레이션 안될듯?
만약에 str으로 가기로 결정했으면 여기 모델들도 다 str으로 고쳐줘야할거같아요 개귀찮겠다

  • Session.userId
  • Account.userId
  • ProjectRole.userId
  • Project.createdById
  • Feedback.userId

@@map("user")
}

model Session {
Copy link
Contributor

Choose a reason for hiding this comment

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

기존 프로젝트 컨벤션에 맞춰 @@map("session")과 각 필드의 @map("snake_case")를 추가해주세요.

단, better-auth가 직접 DB 쿼리를 실행하므로, better-auth 설정의 테이블/컬럼명과
Prisma @map이 정확히 일치해야 합니다.
better-auth adapter 문서에서 컬럼 매핑 설정을 확인해주세요.

아 이건 제가 제미나이가 마지막 검토때 알려준 부분이라서 정확히는 저도 잘 모르겠음... 시간 부족으로 더 구체적인 조사 못해봄... 다른 분들이 맞는지 확인해주세요 ㅋㅋㅋ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants