From: Carl Worth Date: Wed, 30 Dec 2020 20:31:12 +0000 (-0700) Subject: Add a hunt_id attribute and index to the database for hunts X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;ds=sidebyside;h=460a2c781b3ad2ea1d2e2cdc812803ef6ec64e6b;p=turbot Add a hunt_id attribute and index to the database for hunts This will allow the Turbot home view to scan the hunt_id_index to find all existing hunts, (without having to scan non-hunt items from the database). --- diff --git a/turbot/interaction.py b/turbot/interaction.py index 343eca6..8fdebae 100644 --- a/turbot/interaction.py +++ b/turbot/interaction.py @@ -114,6 +114,7 @@ def new_hunt_submission(turb, payload, metadata): {'AttributeName': 'PK', 'AttributeType': 'S'}, {'AttributeName': 'SK', 'AttributeType': 'S'}, {'AttributeName': 'channel_id', 'AttributeType': 'S'}, + {'AttributeName': 'hunt_id', 'AttributeType': 'S'}, ], ProvisionedThroughput={ 'ReadCapacityUnits': 5, @@ -132,6 +133,19 @@ def new_hunt_submission(turb, payload, metadata): 'ReadCapacityUnits': 5, 'WriteCapacityUnits': 5 } + }, + { + 'IndexName': 'hunt_id_index', + 'KeySchema': [ + {'AttributeName': 'hunt_id', 'KeyType': 'HASH'} + ], + 'Projection': { + 'ProjectionType': 'ALL' + }, + 'ProvisionedThroughput': { + 'ReadCapacityUnits': 5, + 'WriteCapacityUnits': 5 + } } ] ) @@ -155,6 +169,7 @@ def new_hunt_submission(turb, payload, metadata): Item={ "PK": "hunt-{}".format(hunt_id), "SK": "hunt-{}".format(hunt_id), + "hunt_id": hunt_id, "channel_id": channel_id, "active": False, "name": name,