0

I'm pretty clueless about SQL and how to layout a database.

I want to store users and character sheets inside an SQLite database. I'm not really sure how I should structure my databases. I plan on the following thing:

  • A table of users with a reference to the characters.
  • A table of characters that contains all values that can easily be structured.
  • A table of skills that contain a reference to the character that has it.
  • Tables for everything that has multiple values per character in a similar fashion.

Since most of these things, that can have multiple values are simple strings I would prefer having a column that has an array.

I'm using sqlite3.

Do you think an array column is a good idea and even possible?

  • "Do you think an array column is a good idea" -- No! It violates the first normal form. See ["Is storing a delimited list in a database column really that bad?"](https://stackoverflow.com/questions/3653462/is-storing-a-delimited-list-in-a-database-column-really-that-bad). – sticky bit Dec 19 '20 at 21:58
  • I have to clarify that most of the things I would store in an array are only ever read from and never written. I want to use an orm, so I can use the query result as an object. – Stefan Schmelz Dec 20 '20 at 10:37
  • If they're never written there is never any data in it and they might be omitted as well. ;) But whether there are writes to them or not and whether there's an ORM on top or not doesn't change the normal form violation problem. – sticky bit Dec 21 '20 at 00:48
  • I mean they are never written after the initial creation of a record. But I started to realize that doing it otherwise is simpler with sequelize – Stefan Schmelz Dec 27 '20 at 19:49

0 Answers0