graphprotocol / graphprotocol/graph-node
Introduce uniquness constraints for entity fields
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Rust
- Sterne
- 3.2k
- Forks
- 1.1k
- Ø Merge
- 4 T. 1 Std.
- Gemergte PRs (30 T.)
- 1
Beschreibung
It would be useful to be able to provide uniqueness constraints for entity fields, importantly
- each constraint should be able to cover more than one field
- it should be possible to define more than one such constraint per entity
This constraint should be enforced at the database level, helping the mapping author from making mistakes, and also would clarify the semantics of the data model to third parties looking at the entity definition.
It is not possible to capture both of these properties by simply picking a suitable id field, take the following example.
I have a Profile entity that holds both a handle: String! and an account: Bytes!.
I may want to model the fact that both must be unique independently. In this case, using the entity ID = account||handle does not work, it is too loose, it allows two profiles which have the same handle value, but distinct account.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Das Issue nennt keine Implementierungsdateien oder Tests. Beginne damit nachzuverfolgen, wie Entitätsfelder und Bezeichner definiert und persistiert werden, und entwirf anschließend Unterstützung für mehrere Eindeutigkeitsbeschränkungen auf Datenbankebene, einschließlich Beschränkungen, die sich über mehrere Felder erstrecken; abgeschlossen ist die Aufgabe, wenn sowohl unabhängige als auch zusammengesetzte Beschränkungen dargestellt und durchgesetzt werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust
- Bereich
- database
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100