dwyl / github-backup

:octocat: :back: πŸ†™ Backup your GitHub Issues so you can still work when (they/you are) offline.
https://github-backup.herokuapp.com
GNU General Public License v2.0
31 stars 3 forks source link

Use github ids as primary keys #101

Open SimonLab opened 6 years ago

SimonLab commented 6 years ago

ref: https://github.com/dwyl/github-backup/pull/99#discussion_r174958635 Instead of letting Ecto create the ids automatically for the inserted items we can use the ids given by Github as our primary keys

SimonLab commented 6 years ago

From: http://phoenixframework.org/blog/custom-primary-key

Note: While Ecto allows us to do this, it’s not the natural path Ecto wants to take. Allowing Ecto to use an auto-incremented integer is definitely the right way to go for new applications.

Which I think push me at the begining of the project to let Ecto create its own ids. I don't think the value of defining manually our primary keys based on the Github ids is good for the time it will take us to implement this. Removing all the Ecto current primary keys will break all the association on the database. So at the end I think I would prefer at this stage to keep the current structure of the database. However I think #94 (adding index and constraints on the Github ids) will make sure that the database doesn't have any duplicates and will allow us to get data more quickly with indexes.

nelsonic commented 6 years ago

@SimonLab agreed. πŸ‘