I must persist handful of properties for several games in relational DB. No other type of DB can be used. Number of games will be around 4-5, and number of properties is (for now) kind of small, but maybe it will grow later. It is almost guaranteed that all games will have same properties (same "keys" to say, not same values). My preferred desing for now is this:
CREATE TABLE GamesProperties
(
propertiesId NUMBER(38,0) NOT NULL,
gameId VARCHAR2(16 CHAR) NOT NULL,
cancelPeriod NUMBER(4,0) DEFAULT 5 NOT NULL,
prizeName VARCHAR2(16 CHAR) NOT NULL,
CONSTRAINT PK_TGP PRIMARY KEY (propertiesId),
CONSTRAINT UC_TGP_gid UNIQUE (gameId)
);
But a coworker said that in my design we would have to alter table every time we need to add new property (which I agree), and that he would prefer to see something like this:
CREATE TABLE GamesProperties
(
propertiesId NUMBER(38,0) NOT NULL,
gameId VARCHAR2(16 CHAR) NOT NULL,
propertyName VARCHAR2(16 CHAR) NOT NULL,
propertyValue VARCHAR2(16 CHAR) NOT NULL,
CONSTRAINT PK_TGP PRIMARY KEY (propertiesId)
);
In his solution we wouldn't have to alter table at all in the future, but we lose information about datatype of a property which I think is a major downside.
I would like to hear what are some other pros and cons for each solution so I can make informed decision about the design we'll use.