I'm developing this Achievement System and it must have a CRUD, that admins access to create new achievements and it's rules. I need some help with the Achievement CRUD data structure.
Medal one: must complete 5 any courses with a score of at least 90
Medal two: must complete two specific courses with a score of at least 85
Medal three: must be top 5 in general ranking at least once
Medal four: must have more than 5000 points
I'll store that in a SQL database and thought about two options.
Create a table with a few columns like below to store those multiple variables when suited:
- action quantity
- course quantity
- id course
- ranking position
Store that using JSON or serialized format, so all the logic of parsing that is inside my code, downside is it will make it more complex to query some rules (not sure i'll need to query it, but I like to be ready just in case).
Bear in mind there is a high chance that I'll have to add more rules to this system, that's why I'm asking this.
Is there a more suitable way of doing that, perhaps a design pattern, a known solution or something already created for this scenario?