I am trying to make a tracking app.
For each subject I want to track, there are several parameters, for example: Sub1 has several params P1, P2, P3. These parameters change over time (this is why I want to track them). The app allows tracking of several subjects: Sub1, Sub2, Sub3...SubN and they all have the same set of parameters.
One approach is to create a table for each subject, with each parameter is a column. This way the table for Sub1 might have 4 columns like this: Day, P1, P2, P3.
There is one problem with this approach: If I were to use Room, I would have to predefine all the subjects I want to track, and create all the tables for them beforehand. Which mean I can't allow the user of the app to easily add new subjects to track in the future, because each time a new subject is added, then a new table must be created for it, which means a change in Room database schema, which requires database migration...
Is there a more flexible approach which allows the user to add new subjects to track, without the need to perform database migration?
question from:
https://stackoverflow.com/questions/65953084/how-to-design-database-schema-for-a-tracking-app 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…