Best way to structure a database?

I’m building a simple job board app where users can login and view jobs. They can also filter the jobs on the site to only view jobs that they have applied for, and they can also save jobs and then view a list of their saved jobs.

My idea was that I would have fields within the User Type for “applied jobs” and “saved jobs”. When a user clicks “apply” on a job, that job would be written to that user’s “applied jobs”. Similarly, when a user clicks “save” on a job, it would be written to their “saved jobs”. Then I could pull up the “applied jobs” or “saved jobs” in a repeating group.

This approach works fine but I just wondered if there is a leaner way to do this without writing so much data? I felt it was possibly too complex?

Any insights are always greatly appreciated.

Thanks

No, this is the right way. You have to write data to create relations between things. Actually, you’re not really writing that much data as you create relations between the things, not write the whole thing again in your user type.

When you’re structuring a database, it’s good to think about the overall functions you want for your app to have, then to build a database structure that properly supports those functions.

By asking things like, "What should saving a job do? Should it send reminders to the user if they haven’t applied? How will I update the user when that position is no longer available?

Your current approach is about as lean as you can get. (Saving a simple list on the user). However, the drawback is a lack of ability to capture related data (ex. when did this user apply, what is the status of their application, etc.).

By creating a secondary table, “Ex. Saved_Job_Record” and then saving that as a list on the user, you can nest various points within that record. Additionally, as you think of the functionality for a business on the platform, a “Saved_Job_Record” can be a shared record between the company and the applicant. (Ex. “Hey [company], you have a new interested applicant).”

1 Like

Thanks for the explanations guys! That’s really helpful. I’m glad to hear I’ve gone about this the right way. This is my first build so in future I think I would plan the database structure before doing anything else. Thanks so much again