alejandrobabio / music-api

0 stars 1 forks source link

Deletions #4

Open alex-nexus opened 6 years ago

alex-nexus commented 6 years ago

what happens when deleting an album with songs? what happens when deleting a band with songs? what happens when deleting an artist with an album?

alejandrobabio commented 6 years ago

In the first case that is the only one that has been programmed so far, to delete an album with songs, the relation is has_many: songs, dependency:: nullify which will allow to erase the album and leave the songs in the database without album assigned. Actually, I defined the album param as optional for songs. Eventually, a song can never have an album (e.g .: singles). If I made the decisions, I would leave the children alive and orphans in the three cases (it will also require a depuration task in the future). Anyway, this is clearly a business rule that must be defined by the product owner, then we write the programs so that they work accordingly.