mysql - Are polymorphic relationships bad practice? -
i'm using laravel , have run need have polymorphic relationships. seem solve need, being able store different data based on type, in nutshell.
however, i'm aware not able use constraints, foreign keys. , i've read around they're anti-pattern. wondering others think it, , if using them without issues.
otherwise, there alternative way accomplish polymorphic relationships provide, without using them? (using laravel)
polymorphic relations anti-pattern , breaks best practices principles per mjolnic comment.
having said this, never store json in blob or text column? wordpress not store data serialized in mysql?
in real-world, (outside of university), there many scenarios idea break rules. depending on specific use-case, may appropriate break them.
simple blog example. have posts, have pages. both need same table format. benefits gained polymorphic relations far outweigh effort put normalising , development , maintenance when splitting content posts
, pages
.
Comments
Post a Comment