]> git.cworth.org Git - turbot/commit
Beginning of transition to single-table database schema
authorCarl Worth <cworth@cworth.org>
Tue, 29 Dec 2020 23:33:37 +0000 (16:33 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 30 Dec 2020 20:04:38 +0000 (13:04 -0700)
commitd57bca01664cb9ab20213ba1f4cf82fdb672b08c
tree51c0b35807066ba46d6aa38b065781a9ea0e9f45
parent01ef7b71ad45338427c61722dbbee4fb19759661
Beginning of transition to single-table database schema

This is aiming for a one-big-table approach, (which is the DynamoDB
best practice), instead of having one table for hunts and then a
separate per-hunt table for puzzles.

This new approach will be more flexible as we start adding database
items for rounds, etc. In the old approach, rounds would likely have
become yet another hunt-specific table, and the number of per-hunt
tables would have started to become rather messy.

With this new schema, rounds can instead be just another item, where
hunts, rounds, and puzzles can all be intermingled as items in the
same table.

To get this all to work, we are creating secondary indexes for
querying items from the database via attributes other than the primary
key, (for example a "channel_id" index).

As of this commit, the "New Hunt" button works in that it:

  * Creates the turbot DynamoDB table if it doesn't exist

  * Inserts a new item into the table for the hunt itself (active=False)

  * Marks the sheet_url of the item as "pending"

  * Creates a new channel for the hunt

  * Responds to the channel_created event

  * Creates a Google sheet for the hunt

  * Stores the sheet_url in the database

  * Marks the hunt as active=True in the database

  * Reports to the Slack channel that things are working

So that much is working, but everything else has yet to be converted
to the new schema. So things that don't yet work include at least:

  * The turbot "Home" view doesn't yet display anything

  * The /puzzle command doesn't work yet
TODO
turbot/events.py
turbot/interaction.py
turbot_lambda/turbot_lambda.py