I’m learning and trying to make a site but I’m a bit confused about a data model. My site is similar to github in that you can follow people and copy/share stuff(similar to forking/pull requests). How can I make a data model to store this?
Basically, I write an article and the article is associated to me. Then you come and ‘fork’ my article, do I make a copy of it? or is it just a link? then after editing your version you send me a request to merge our content together(I don’t want to overwrite the data but not sure how to do it in a way that is captures the differences). To make matters worst for me, I want to have versioning on edits, which makes it complicated when I’m doing versioning on forked data.
I don’t know where to start..I don’t need the answer but any suggestions on how to model this fork/merge interaction would be great. I haven’t decided if I’ll use redis or mysql yet but a general answer is okay if I can apply the logic to either.
Create 2 models: Article and ArticleRevision. User has many articles associated with him (owner of the article), and article has many revisions:
Current revision of Article is determined by
current_revision_idfield. Revision has a parent revision – this is a revision from which it is originated.When someone forks an article: