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

db: create a populate file to have data in local db #51

Open
ruialves35 opened this issue Nov 15, 2022 · 2 comments
Open

db: create a populate file to have data in local db #51

ruialves35 opened this issue Nov 15, 2022 · 2 comments
Assignees
Milestone

Comments

@ruialves35
Copy link
Contributor

Currently the local database when we first run the program doesn't have any items.
It would be nice to have something to populate the database so we can see some events, projects, etc.

@ruialves35 ruialves35 added this to the Website MVP milestone Nov 15, 2022
@BrunoRosendo
Copy link
Member

One way to do this is creating a data.sql script under resources/: https://www.baeldung.com/spring-boot-data-sql-and-schema-sql
However, this requires writing it directly in SQL and it will get outdated very fast, so think about alternatives before implementing.

There are other approaches mentioned here: https://stackoverflow.com/questions/38040572/spring-boot-loading-initial-data
Some solutions include hard coding the initialization data but I'm not fond of changing code before deploying (resources are a different story)

@ttoino
Copy link
Member

ttoino commented Feb 12, 2023

Another good approach may be to use a library like this one to generate random data: https://www.baeldung.com/java-faker

If reproducibility is a concern I'm sure there's a way to set the initial seed so it's the same for everyone

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

No branches or pull requests

4 participants