1602 / 1602/jugglingdb

Adapter should be able to define default primary key type

Offen Anfängerfreundlich
#290 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
2k
Forks
238
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Right now in schema.js (https://github.com/1602/jugglingdb/blob/master/lib/schema.js#L232): `properties.id = properties.id || {type: Number}`

It's not correct for RethinkDB for example, where default id is UUID represented as String. It does not really matter for relations if you defineForeignKey properly, but if you try to implement data type check when converting to/from database values it could bring up problems.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

The issue points to lib/schema.js line 232 where the default primary key type is hardcoded to Number. Look at how adapters (like the RethinkDB adapter) are structured to understand how to let an adapter define its own default ID type. Check existing adapter files for patterns, then modify schema.js to read a default from the adapter. Test by creating a model without an explicit ID definition and verifying the correct type is used.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
databases, javascript, node.js
Bereich
backend, databases
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
65/100

Neue Issues direkt in Ihr Postfach

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