Skip to content

Database schema

Douglas Naphas edited this page Feb 17, 2019 · 4 revisions

Database schema

Mad Liberation's database is one DynamoDB table, called seders.

Items represented.

seders is a heterogenous table representing:

  1. seders,
  2. participants,
  3. scripts, and
  4. libs.

Primary key

The primary key is room_code|lib_id.

Partition key: room_code

room_code is the partition key. It is six capital letters.

For participants and libs, room_code gives the associated seder. For scripts, room_code is a unique identifier starting with AAA that must be different for each script.

Sort key: lib_id

lib_id is the sort key.

lib_id is:

  1. The type of item, which can be seder, participant, script, or lib, and then, in the case of everything but seder:
  2. A # (hash)
  3. Further information about the item, which is:
    1. For participants, the lowercase, 64-byte, hexadecimal, SHA256 hash of the Game Name.
    2. For scripts, the script number.
    3. For libs, the lib number. It must be different for each lib within a seder.

Global secondary index

There is a global secondary index script_index, a number, that:

  1. Identifies the record as being a script, and
  2. Gives the order in which the scripts should be listed on the Pick Your Script page.

Local secondary index

There is a local secondary index, lib_order, a number, that gives the order in which libs appear.

TODO: check whether LSIs can be sparse.

Implementation status

This document describes the schema as it will eventually be.