agnyz / the-bed-stack

Bun + ElysiaJS + DrizzleORM = the stack you don't want to sleep on 🛌💤
https://agnyz.github.io/the-bed-stack/
MIT License
39 stars 3 forks source link

feat: data faker #69

Closed aruaycodes closed 1 year ago

aruaycodes commented 1 year ago

Description

closes #15 Added a fakerjs that creates 10 fake user data when running:

bun db:seed


PR Checklist (Please do not remove)

yamcodes commented 1 year ago

@aruay99, thank you so much for the contribution.

  1. As a convention, I've edited your title from feat: added data faker to feat: data faker. The the AngularJS Git Commit Guidelines linked in our CONTRIBUTING.md states:

    Subject

    The subject contains succinct description of the change:

    • use the imperative, present tense: "change" not "changed" nor "changes"
    • don't capitalize first letter
    • no dot (.) at the end
  2. Kindly make sure to handle all items on the checklist in your next PR. This helps us ensure code quality and convention and removes friction.

yamcodes commented 1 year ago

I'm testing this PR locally, ideally seed should be idempotent, which means that if it's ran on every boot of the container we shouldn't create new users.

A potential fix is to truncate the affected table before inserting, which will ensure in this case there is exactly 10 users after every seed.

In that case, we can remove the onConflictDoNothing() statement here which will become uneccesary.