i'm working on a social network. With activity (like, comment, follow, post, etc...), user, page-to-follow, album, photo and some other thing.
Now, one of the most important things in a social network is the activity feed. I've a structure with activity_feed table, user_table, follow_table, like_table, etc... i was thinking: what if i use a unique AUTO INCREMENT to identify every single entities in my app?
Example:
A user join my site by registration:
- Add the activity to activity_feed (and obtain an ID)
- Add the user to user_table (with foreign key to activity_feed)
Example 2:
A user upload a photo:
- Add the activity to activity_feed
- Add the photo to photo table (with foreign key)
This will simplify api calls (ex: http://api.domain.com/ID), DELETING entities, future database sharing and many other things.
I notice that facebook have a structure like this. Obviously indexing can be made on other tables (ex: activity_index_type with activity_type -> user and activity_id).
might be a good solution?
Sorry for my english! :$