Data Modeling
The Building block of Ideas
This crucial step is imperative to ferry us across ignorant waters. We might want to structurize and froth a visual image of our app.
Let’s unwind the past a bit.
Now for the cover story,
The Catch is to make Postgres work for us.
PonyORM makes it easy for you to create a database in Python, perceive relations as objects, fields as attributes and also supports ER to Relational Schema mapping.
Here, I literally open up ‘Objective’ Ideas that define my app’s DB integrity.
Auth Rules
I should credit Hasura for a Session Store, or the Middleware that tracks user sessions across devices. Cool eh.
My User Tweak with DB is to set up a dedicated Table to hold Deeper user info.
As mine is a Social Media cum Song App, say, you may want to know the user’s passion with music and credibility on a music stream of his choice.
Say, I’m a Pop Singer/ fan and my experience with Pop concerts have deep childhood bonds. I’ve never missed an one-time radio show on R-City that features the best Pop of the week.
So, the user may want to put this up, but he is nobody until he identifies himself with his bunch. That’s why, I’ve a field for his Profile name, Place of work, City and a short 2 line description, for people to connect with.
Working in Sync with Auth
So every user is obviously asked for an username/mobile Sign In and the corresponding hasura_id is mapped with id from the User table, so that I can render the right user with right feeds.
Note: I don’t want fake accounts, so I’ve a mobile verification with MSG91 setup.
Friends Matter
An Integral Part of Song Sharing is getting to know new people and expose your routine to a multi-color environment. I believe that friends can make a difference in our life with everything we do, positively :)
There’s a Friend Table that stores the user_id of the one who first sends a request and the friend_id is the one to whom the request is intended.
But how do I find my friends, the people to whom I can send out invites and guys who have sent for me?
App Goals Visited
This is a Song App right? So where are the songs?
I plan to utilize the filestore DB running on the local cluster into saving songs. And the Relational Schema into mapping users with the song ids.
The Ultimate Destiny of Social Media
If you can’t comment on your friend’s song or tag them or even like some, it’s no different from streaming songs from your local device in solitude.
There are no strangers here and nobody is striped from raising opinions. That calls for a new entities.
And the statistics with number of likes and comments is dangling. Let’s fix that with views.
So now every song tab has got this,
Conclusion
If I were to join the tables for invites and confirms, that would place a heavy resource overhead on the UI thread, but a Data Model Design has solved my crisis.
They sure are omnipotent :)
Moral of the story is,
It’s a standout procedure to plan anything before doing
Stay tuned for more :)