Should I use one table if derived tables would all use the same record layout?

39 Views Asked by At

I'm developing a game SDK, which centers on establishment and persistence of storyline, characters, leveling, etc.

I started with a mindmap of the different classes, and am now in the process of bringing those simple representations into UML. Since persisting of the game's objects will be done using SQLite, I am representing classes as database record types. One of those record types, RangedProperty, is used in multiple tables: Factions, Traits, Statuses, etc.

CREATE TABLE [RangedProperty] (
  [UID] INTEGER NOT NULL ON CONFLICT FAIL, 
  [OID] INTEGER NOT NULL, 
  [Name] TEXT, 
  [Description] TEXT, 
  [Tag] TEXT, 
  [Min] INTEGER DEFAULT 1, 
  [Max] INTEGER DEFAULT 100, 
  [Current] INTEGER DEFAULT 50);

Since the tables are all using the same record type, would it make sense to leave the Tag field in place, and - rather than using separate tables for Factions, Traits, and so on - simply use the same table for them all? It seems like that would contribute to reliability, since changes to the record type only need to be made for the one table, thus reducing the likelihood of error.

Thanks!

Note: I have thought of using INTEGER for the field type, since it would make for faster comparisons, but consider that a moot point if the Tag field isn't used.

0

There are 0 best solutions below