我想编写我的dynamodb模式的文档。
是否有文档的图表,还是应该使用ER图?
发布于 2020-08-18 17:23:52
我认为定义ER图是一个很好的实践。您将以一种与DB无关的方式建立实体及其相互关系。
在此期间,我建议创建一个列出以下内容的文档:
看看亚历克斯DeBrie为他的例子建模在他的AWS演讲中是如何获得一个好例子的。
ER图是理解数据模型的极好参考,我认为每个数据库都应该有一个作为其文档的一部分。使用DynamoDB,了解访问模式以及如何设计主键来支持访问模式是至关重要的信息。
发布于 2020-08-20 04:41:36
我喜欢亚历克斯的书。
我在我的文档生成中使用PlantUML,它可以通过Planttext在线获得。对我来说最大的好处是,你用纯文本来做图表,这样它就会很好地不同,和源代码一起签入。
PlantUML有一个标准ERD语法,它是OO类图的扩展。在下面的示例中,我稍微滥用了它,以包含一些子类关系。

@startuml
title Touchgram Content Store
entity Artist {
* Name
* Bio
UsualLicense
}
entity PhysicalGallery {
* Name
* Address
* Contact
Description
}
entity OnlineGallery {
* Name
* WebAddress
Description
}
entity PhysicalProduct {
* Name
Description
}
entity DigitalSale {
* Price
* Timestamp
}
note bottom of DigitalSale : All digital sales\nare totally anonymous\nvia online credit
entity DigitalProduct {
* Name
* DownloadFile
* Price
License
}
entity DigitalAvail {
* Price
* DateRange
Comments
}
Artist }o..|| DigitalProduct
DigitalProduct }o..|| DigitalSale
DigitalProduct }o..|| DigitalAvail
DigitalProduct }o..|{ PhysicalProduct
DigitalProduct <|-- Image
DigitalProduct <|-- Sound
DigitalProduct <|-- VisualEffect
DigitalProduct <|-- Template
Template }o..o{ DigitalProduct : "Uses Other\nProduct"
note bottom of Template : Template Touchgrams\n(eg: greeting cards or memes)\nCan use digital products\nfrom many artists\nso license & sales would\ncascade through
note bottom of DigitalAvail : By default, available\nas soon as in store\nbut restrictions can be added
Artist }o..o{ PhysicalGallery : Exhibits at
Artist }o..o{ OnlineGallery : Advertises
OnlineGallery }o..o{ PhysicalGallery : Advertises
PhysicalProduct }o..o{ OnlineGallery : Sold through
PhysicalProduct }o..o{ PhysicalGallery : Shown at
note "Normally one digital version\nwould exist of a canvas\nbut often offer prints\n\nconversely, more rarely\nmight do several digital\nversions of a work\neg: with different filters\nor even crop portions\n\nWe **do not** handle\nphysical sales" as N1
N1 .. PhysicalProduct
@endumlhttps://stackoverflow.com/questions/63468150
复制相似问题