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

✨ [Feature] database seeding #96

Merged
merged 6 commits into from
Apr 18, 2023
Merged

Conversation

jis-kim
Copy link
Contributor

@jis-kim jis-kim commented Apr 18, 2023

Summary

  • Auth, User, Friendship, Message seeding.
  • 나머지 테이블은 필요할 때 다시 추가 생성하겠습니다..

Describe your changes

  • faker 를 이용한 랜덤 seed data 생성
  • .env 파일에 TEST_DB_NAME 을 추가해서 테스트용 database 관리
    • 개발 단계기 때문에 DB_NAME 과 똑같이 설정하시는 게 편할 수 있습니다.
    • 중복 데이터가 들어가면 error 가 발생하기 때문에 주의
  • yarn seed [number] 로 시드 데이터 생성
  • 설정한 number 만큼 auth 테이블의 row 가 생성되고 확률에 따라 user, friendship, message 가 생성됩니다.
    Screenshot 2023-04-18 at 6 48 13 PM
  • yarn seed:reset 하시면 .env 에 설정하신 TEST_DB_NAMEdropdbcreatedb 됩니다.
  • 핀 해놓은 nest app 실행법 이슈에 사용법을 추가하도록 하겠습니다!

Issue number and link

- auth 시딩파일 설정
- `yarn seed` 으로 시딩
- `yarn seed:reset` 으로 시딩할 디비 리셋
- user, friend factory 추가
- typeorm-extension 안쓰는 방법으로 refactoring
- message seeding 파일 추가
- .env.sample 에 Test db 추가해서 관리
@jis-kim jis-kim added enhancement New feature or request backend issue for backend labels Apr 18, 2023
@jis-kim jis-kim self-assigned this Apr 18, 2023
- accept: true 일 때만 last_message_time 생성되도록 변경
@jis-kim
Copy link
Contributor Author

jis-kim commented Apr 18, 2023

Copy link
Member

@Kimhan-nah Kimhan-nah left a comment

Choose a reason for hiding this comment

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

오나전 지대 짱입니닷.... 감사합니다..ㅎㅎ faker....신기하네요 고생하셨습니다~~!!!

Copy link
Member

@anso33 anso33 left a comment

Choose a reason for hiding this comment

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

감사합니다 선생님..

@jis-kim jis-kim merged commit 50a5961 into main Apr 18, 2023
@jis-kim jis-kim deleted the feature/back/database-seeding branch April 18, 2023 12:30
@@ -0,0 +1,41 @@
//import dotenv
Copy link
Contributor

Choose a reason for hiding this comment

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

이상한 주석이 있어요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2023-04-19 at 11 28 31 AM

다음 pr 에 반영하겠습니다 ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend issue for backend enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

💚 [Chore] 초기 데이터 시드 생성하는 seeding 파일 생성
4 participants