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

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -