Hello,
I'm using the loopback_postgresql connector and I used Strong-Studio to generate the model for my Customer table. I did not change any of the properties besides indicating what field was the ID.
I ran the app with DEBUG on the connectors like so: NODE_ENV=staging DEBUG=loopback:connector:* slc run, and when the connector is executed I see the following:
loopback:connector:postgresql SQL: SELECT "id", "customername", "customerkey", "website", "twitter", "created", "modified", "approved", "active", "measurement", "eula" FROM "public"."customer" ORDER BY "id" +10s
Note: FROM "public"."customer"
When I fire up Loopback explorer and do a call to get all customers I get the following error:
loopback:connector:postgresql error: relation "public.customer" does not exist
at Connection.parseE (/Library/WebServer/Documents/myapp/node_modules/loopback-connector-postgresql/node_modules/pg.js/lib/connection.js:534:11)
at Connection.parseMessage (/Library/WebServer/Documents/myapp/node_modules/loopback-connector-postgresql/node_modules/pg.js/lib/connection.js:361:17)
at Socket.<anonymous> (/Library/WebServer/Documents/myapp/node_modules/loopback-connector-postgresql/node_modules/pg.js/lib/connection.js:105:22)
at Socket.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:764:14)
at Socket.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:426:10)
at emitReadable (_stream_readable.js:422:5)
at readableAddChunk (_stream_readable.js:165:9)
at Socket.Readable.push (_stream_readable.js:127:10)
I do not have any relations defined in my model. Does this error have something to do with the schema of my postgres database?
Here is my model definition:
{
"name": "Customer",
"idInjection": false,
"postgresql": {
"schema": "public",
"table": "Customer"
},
"properties": {
"id": {
"type": "Number",
"id": true,
"required": true,
"length": null,
"precision": 64,
"scale": 0,
"postgresql": {
"columnName": "id",
"dataType": "bigint",
"dataLength": null,
"dataPrecision": 64,
"dataScale": 0,
"nullable": "NO"
}
},
"resellerid": {
"type": "Number",
"required": false,
"length": null,
"precision": 64,
"scale": 0,
"postgresql": {
"columnName": "resellerID",
"dataType": "bigint",
"dataLength": null,
"dataPrecision": 64,
"dataScale": 0,
"nullable": "YES"
}
},
"customername": {
"type": "String",
"required": false,
"length": 75,
"precision": null,
"scale": null,
"postgresql": {
"columnName": "customerName",
"dataType": "character varying",
"dataLength": 75,
"dataPrecision": null,
"dataScale": null,
"nullable": "NO"
}
},
"customerkey": {
"type": "String",
"required": false,
"length": 50,
"precision": null,
"scale": null,
"postgresql": {
"columnName": "customerKey",
"dataType": "character varying",
"dataLength": 50,
"dataPrecision": null,
"dataScale": null,
"nullable": "YES"
}
},
"addressid": {
"type": "Number",
"required": false,
"length": null,
"precision": 32,
"scale": 0,
"postgresql": {
"columnName": "addressID",
"dataType": "integer",
"dataLength": null,
"dataPrecision": 32,
"dataScale": 0,
"nullable": "YES"
}
},
"website": {
"type": "String",
"required": false,
"length": 100,
"precision": null,
"scale": null,
"postgresql": {
"columnName": "website",
"dataType": "character varying",
"dataLength": 100,
"dataPrecision": null,
"dataScale": null,
"nullable": "YES"
}
},
"twitter": {
"type": "String",
"required": false,
"length": 25,
"precision": null,
"scale": null,
"postgresql": {
"columnName": "twitter",
"dataType": "character varying",
"dataLength": 25,
"dataPrecision": null,
"dataScale": null,
"nullable": "YES"
}
},
"created": {
"type": "String",
"required": false,
"length": null,
"precision": null,
"scale": null,
"postgresql": {
"columnName": "created",
"dataType": "timestamp without time zone",
"dataLength": null,
"dataPrecision": null,
"dataScale": null,
"nullable": "NO"
}
},
"modified": {
"type": "String",
"required": false,
"length": null,
"precision": null,
"scale": null,
"postgresql": {
"columnName": "modified",
"dataType": "timestamp without time zone",
"dataLength": null,
"dataPrecision": null,
"dataScale": null,
"nullable": "NO"
}
},
"approved": {
"type": "String",
"required": false,
"length": null,
"precision": null,
"scale": null,
"postgresql": {
"columnName": "approved",
"dataType": "timestamp without time zone",
"dataLength": null,
"dataPrecision": null,
"dataScale": null,
"nullable": "YES"
}
},
"active": {
"type": "Boolean",
"required": false,
"length": null,
"precision": null,
"scale": null,
"postgresql": {
"columnName": "active",
"dataType": "boolean",
"dataLength": null,
"dataPrecision": null,
"dataScale": null,
"nullable": "NO"
}
},
"brandingid": {
"type": "Number",
"required": false,
"length": null,
"precision": 32,
"scale": 0,
"postgresql": {
"columnName": "brandingID",
"dataType": "integer",
"dataLength": null,
"dataPrecision": 32,
"dataScale": 0,
"nullable": "YES"
}
},
"measurement": {
"type": "String",
"required": false,
"length": 20,
"precision": null,
"scale": null,
"postgresql": {
"columnName": "measurement",
"dataType": "character varying",
"dataLength": 20,
"dataPrecision": null,
"dataScale": null,
"nullable": "YES"
}
},
"eula": {
"type": "String",
"required": false,
"length": 255,
"precision": null,
"scale": null,
"postgresql": {
"columnName": "eula",
"dataType": "character varying",
"dataLength": 255,
"dataPrecision": null,
"dataScale": null,
"nullable": "YES"
}
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": []
}
Thank you! any help is appreciated.
Nolan