graphprotocol / graphprotocol/graph-node

Introduce uniquness constraints for entity fields

Offen
#1,711 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

enhancement
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

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Ö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

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.