1602 / 1602/jugglingdb

Adapter should be able to define default primary key type

Abierto Apto para principiantes
#290 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
2k
Forks
238
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
databases, javascript, node.js
Área
backend, databases
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
65/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.