For example I have a table of cars
, each has a model
and a make
. A car can only have one of each, and there is a table of models
and makes
, with their ids auto-generated. Can I reference these in my cars
table? What would the JSON look like?
I tried to create a new field in the cars
table and specify id
in the "Via" text box, but it just creates a new column in the corresponding table, id1. Is there a proper way?
Here is my sample schema JSON:
{
"name": "cars",
"fields": {
"model": {
"object": "models"
},
"make": {
"object": "makes"
}
}
},
{
"name": "models",
"fields": {
"title": {
"type": "string"
},
"make": {
"object": "makes"
},
"id": {
"collection": "cars",
"via": "model"
}
}
},
{
"name": "makes",
"fields": {
"models": {
"collection": "models",
"via": "make"
},
"title": {
"type": "string"
},
"id": {
"collection": "cars",
"via": "make"
}
}
}