I am working with Loopback to automate the creation of REST APIs and using PostgreSQL as my datasource. I am a front-end developer with little experience in database schemas. I have a question about ID columns and how loopback works with databases.
I was given an SQL database that contains a table with the following fields:
typeId | techType | comments
When I try to do a GET request via the Loopback Explorer, I get an error that the request expects an 'id' column:
{
"error": {
"statusCode": 500,
"name": "error",
"message": "column \"id\" does not exist",
"length": 102,
"severity": "ERROR",
"code": "42703",
"position": "60",
"file": "parse_relation.c",
"line": "3293",
"routine": "errorMissingColumn",
"stack": "error: column \"id\" does not exist\n at Connection.parse
//...snip...
}
}
Do I need to manually create an id field in my datasource or do I create the property on the client side via lb model CLI ? Or, other suggestions? What happens if I have hundreds of tables that may be without a vanilla'id' colum (they might be labeled differently)?