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

Database Seeding #35

Open
Xevion opened this issue Sep 25, 2023 · 0 comments
Open

Database Seeding #35

Xevion opened this issue Sep 25, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Xevion
Copy link
Member

Xevion commented Sep 25, 2023

To improve workflows for new developers & testing environments, a database seed would be a good feature.

  • Proper testing of an application during development requires data to flow through and activate it's functions.
  • Database seeding adds "dummy" data, populating tables autonomously.
  • A seed function could be activated automatically for pull requests, or on a developer's machine.
  • Seed functions lower the need for developers to use production environments, as the usefulness of data in production is the same as the dummy data - but the risk is much lower.

Other thoughts:

  • The amount of data shouldn't be high, but it definitely shouldn't be low.
  • It would be good if the data is relevant, i.e. not static. For example, events in the past are nice, but if they're all in the past, then the data is mostly irrelevant. Some of the data should be active the moment the seed is given.
  • For consistency, each table needs to be populated with something. It's not super important that the data activates every function of the table, but it would be nice to maintain that over time. A comment about this should be included wherever the feature is placed.
  • Introspection of the database should be provided, checking that each and every table in the schema is touched in the seed function. If not, it should log a warning. This way, developers using the seed function are given some notice if new tables are added - but not given a proper seed function.

Concerns:

  • A seed function could wipe a production database. Some kind of check should be made to ensure a production database is not wiped accidentally. I am not sure how this could be done, though. Simply checking the environment == "production" is not valid as it would be true for Vercel's branch deployments.
  • It would be good for this to run for pull requests and/or development branches, but spinning up databases for every branch is unfeasible. If the seed function is intended to run regularly during the development cycle on a shared development database, then it should run only for a development branch as part of the push workflow.
@Xevion Xevion added the enhancement New feature or request label Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant