-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
Implement database seeding for development test data
Background
The seed runner at cmd/migrate/seed/main.go is already written and ready to use (currently commented out). It calls db.Seed(store, conn), which still needs to be implemented.
An example seed file exists at internal/db/seed.go from another project (a blog application with users, posts, and comments). This example is for reference only — you need to write a new seed that matches the current database schema.
Task
Implement internal/db/seed.go to generate test data for the current schema.
Tables to seed
1. users
Generate approximately 50–100 test users.
supertokens_user_id: Generate fake IDs (e.g.seed-user-{i})email: Use pattern likeuser{i}@example.comrole: Mix ofhacker,admin,super_admin(mostly hackers)auth_method: Mix ofpasswordlessandgoogleprofile_picture_url: Optional; may beNULLor placeholder URLs
2. applications
Generate applications for users with the hacker role.
- Mix of statuses:
draftsubmittedacceptedrejectedwaitlisted
- Realistic fake data for:
- names
- universities
- majors
- other profile fields
short_answer_responses:- Stored as
JSONB - Keys must match default questions:
why_attendhackathons_learnedfirst_hackathon_goalslooking_forward
- Stored as
dietary_restrictions:- Array of enum values (
vegan,vegetarian,halal, etc.)
- Array of enum values (
- For submitted applications:
submitted_atmust be set- Acknowledgment fields must be true
Implementation notes
- Use existing store methods:
store.Users.Createstore.Applications.Create- etc.
- Wrap user creation in a transaction (as shown in the example seed)
- Use random selection from arrays of realistic sample data
- Ensure referential integrity:
- Applications must reference existing users
- Applications with
status = 'submitted'must have:ack_application = trueack_mlh_coc = trueack_mlh_privacy = true- (required by database constraints)
Files to modify
internal/db/seed.go- Uncomment and rewrite the
Seedfunction - Implement any required helper generators
- Uncomment and rewrite the
How to run
After implementation:
- Uncomment the code in
cmd/migrate/seed/main.go - Run:
make seed
Acceptance criteria
- Seed creates 50–100 users with varied roles
- Seed creates applications for hacker users
- Applications contain realistic and varied data
- A mix of application statuses is present
- Submitted applications satisfy all database constraints
- Seed is idempotent or gracefully handles existing data
- make seed runs successfully
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers