diff --git a/services/identity/src/constants.rs b/services/identity/src/constants.rs --- a/services/identity/src/constants.rs +++ b/services/identity/src/constants.rs @@ -91,6 +91,7 @@ "usernameLower"; pub const RESERVED_USERNAMES_TABLE_USERNAME_LOWER_INDEX: &str = "usernameLower-index"; +pub const RESERVED_USERNAMES_TABLE_USER_ID_INDEX: &str = "userID-index"; // Users table social proof attribute pub const SOCIAL_PROOF_MESSAGE_ATTRIBUTE: &str = "siweMessage"; diff --git a/services/terraform/modules/shared/dynamodb.tf b/services/terraform/modules/shared/dynamodb.tf --- a/services/terraform/modules/shared/dynamodb.tf +++ b/services/terraform/modules/shared/dynamodb.tf @@ -292,12 +292,23 @@ type = "S" } + attribute { + name = "userID" + type = "S" + } + global_secondary_index { name = "usernameLower-index" hash_key = "usernameLower" projection_type = "INCLUDE" non_key_attributes = ["userID"] } + + global_secondary_index { + name = "userID-index" + hash_key = "userID" + projection_type = "KEYS_ONLY" + } } resource "aws_dynamodb_table" "identity-one-time-keys" {