Closed nelsonic closed 5 years ago
Refactored:
This is what it looks like when we store the list of people who have "starred" a repository:
I'm still a tiny bit "sceptical" of this as it could "confuse" some beginners ... 💭
I'm satisfied with this refactor as it reduced the number of tables
and introduces a general purpose relationship table which simplifies the code. 👍
If someone reading this tutorial gives us negative feedback (e.g: "you lost me at this point"...) 😕
for the single relationships
table, I'm happy to split out the table into multiple tables. 🔙
For now, I consider this done
. ✅
All three types of relationships are now represented:
Latest ER Diagram:
I think I'm "happy" with this now (as a starting point...) 👍
Right now in the basic example #51 we have three tables which are very similar:
stars
,members
andfollowers
. Here is the current ER diagram:The SQL (CREATE script) looks very repetitive to me:
Given the similarities between I'm considering refactoring them into one table
relationships
:I don't know if that will make it more complex or simplify it. 🤔 🤷♂️
The advantage of having fewer tables is that we can abstract the queries 🔍 and show people a general purpose
relationships
table. 💡 The downside of a singlerelationships
table is that it might "confuse" some beginners ... 😕The way I'm planning this example in my mind is that we will build the app progressively. ♻️ In the beginning we only need two tables:
people
andrelationships
; that's it! 🥇Todo
stars
,members
andfollowers
tables into a singlerelationships
table. 💻