I am working on a project built with Laravel and migrations are already built. The problem, though, is that a lot of tables are built in the regular way (too many columns). I am planning to divide them to multiple tables and connect with relationships.
For instance, this is a users
table (there are much more columns there):
id | username | language | type | name | photo | about | phone | password | time_zone |
---|
What I am planning to do, is to create something similar to WordPress (speaking about table schema, not the code, of course), so there would be tables:
users,
user_metas // or user_options,
posts,
post_metas // or post_options
Each *_metas table will be related to the main model by hasMany relationship (user hasMany options), or even make a single options table with OneToMany relation to User + Post.
This approach, hopefully, will simplify working with DB in some ways, as well as make it simplier to add new options, but, on the other hand, will make it more heavy for the server (have to perform more SQL queries) and will open possibility to more bugs (more code === more bugs). Also, I am not the fan of putting all of the info to one table, since if there are relations, why not to use them?
Have to note, that user and post will have a lot of options, with ability to add new ones (and different posts won't have the same set of options).
So, what approach is better here?