I am trying to weigh up the relative pros and cons of a simple database structure such as this:
1.
CREATE TABLE x (
my_id INT PRIMARY KEY,
...,
text_attribute_blah TEXT,
text_attribute_blah_blah TEXT
);
vs:
2.
CREATE TABLE x (
my_id INT PRIMARY KEY,
...
)
CREATE TABLE attributes (
my_id INT, /* foreign key to x.my_id */
text_attribute_type INT,
text_attribute TEXT
)
Where attribute_type could be blah or blah_blah.
Option 1 offers simplicity - the table is easier to read/write; Option 2 offers flexibility (if we want to add another attribute such as blah_blah_blah, we don't need to make schema changes and so probably fewer code changes.)
Is there a right/wrong answer to this conundrum? Is one of these options considered better practice than the others? Can you point me at further reading that might help be determine the way forward?