-
-
Notifications
You must be signed in to change notification settings - Fork 197
Open
Description
Hello,
I wanted to have a conversation as to how, and if at all, Dynamoid supports the common single table design for DynamoDB.
The basic TL;DR; is the existing STI with some Range Key magic. The Hash Key represents the ability to get all of a common thing, I'm going to use Pizza with a kinda contrived example.
| PizzaId(HK) | ResourceId (RK) | type (Required for Deserialization) | Name | Cost | Quantity | LeftHalf | RightHalf |
|---|---|---|---|---|---|---|---|
| a | pizza | Pizza | Combo | 13.99 | |||
| a | topping-onions | PizzaTopping | Onion | Heavy | true | true | |
| a | topping-peperoni | PizzaTopping | Peperoni | Light | false | true |
This breaks down with the Dynamoid STI implementation.
I'd like to open a conversation about updating the ORM to allow for this pattern and want to toss around some options then identify what would need to be updated to work.
You can query for all toppings on a pizza by using Pizza ID and RK Prefix
First Idea
Allow a range prefix to be specified
class PizzaTopping
range :resource_id, prefix_on_persistance: "topping-"
end
# There is also a need to "fix" the RK for single instance objects
class Pizza
range :resource_id, fixed_value: "pizza"
end
thomaswitt, cdunn and mtamadonDHSE
Metadata
Metadata
Assignees
Labels
No labels