Lately I\'ve been rethinking a database design I made a couple of months ago. The main reason is that last night I read the databse schema of vBulletin and saw that they use
I want to add a small tip. A little off topic, and quite basic, but it's a lot clearer to use enum
instead of tinyint
for status flags, i.e.
enum('user','type')
If there are only two statuses, tinyint
is a little more memory efficient, but less clear. Another disadvantage in enum is that you put a part of the business logic in the data tier - when you need to add or remove statuses, you have to alter the DB. Otherwise it's much more clear and I prefer enum
.