1602 / 1602/jugglingdb

Adapter should be able to define default primary key type

Ouverte Adaptée aux débutants
#290 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
2k
Forks
238
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
databases, javascript, node.js
Domaine
backend, databases
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
65/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.