vishalkpatel's avatar

Best way store multiple types of activities and its data

There's a concept of Exercise and Activities in the Project. For example, An Exercise A has multiple activites in it such as Play Game, Watch Video, etc. Each Activity can have different type of data. The current database design that I think is good for the same is:

Exercises
--------
id	starts_at	 ends_at	created_by

Exercise Activities
----------------
id	exercise_id		type	data

I'll store the type of exercise in the type column as string key (eg. play-game) and based on that value I'll show the UI to user to perfrom activity. I'm planning to have dedicated Activity classes for all those different types of Activities so that I can handle their logic separately.

Is this a good implementation or Is there any better way? What design pattern should I follow to better manage multiple activity classes?

Looking forward to have some feedback or suggestion!

Thanks,

0 likes
1 reply

Please or to participate in this conversation.