(still backlogged at day 6 at the time of publishing)
Despite writing an (not so humble) awesome article detailing my database designing skills, I have had to change up my database structure to better fit HypeTracker into the Laravel ecosystem.
The main reasons are:
- Many implicit functions work with surrogate keys instead of natural keys for the primary key constraint (basically using an integer id instead of a human readable string)
- Eloquent ORM does not support composite primary keys!
I actually already noted the second point in my day 2 post but the combination of these two problems made me unable to retrieve items through the hasMany relationship.
So I just gave up and added id fields as primary keys for all my tables.
Thankfully Laravel migrations made the process of altering table fields using PHP code nice and easy but I am still not happy about wasting that time.
The takeaway? Frameworks have hard rules that are basically "my way or the highway".
Follow my coding adventure on Twitter @justinhodev!