What kind of data model should I use to store historical data?
I'm hacking around with RoR to test devise and omniauth integration. I now have a model with a User and a FacebookUser and TwitterUser that belong to a User.
I can now store data from the Graph API or Twitter API in my objec开发者_JAVA百科ts, but my question is about historical data. If I want to do a kind of twittercounter.com and store history of followers, tweets, etc. What is the best practice to do that ?
What kind of data model ? How often should I update the data and what part should I keep ?
Thanks for your help.
First of all, you should never store a complete copy of an updated row.
In general, most likely you'll stick with approach that implies saving changes as revision control systems do: saving action and differences.
There is a model of saving history of table in another table. You can implement it in your app with little modifications. You can find more in this great read.
精彩评论