Using pg-promise to insert a user into the database like so:
const { db } = require('../../utils/pgAdaptor');
const query = 'INSERT INTO "Users" (email, password, "createdAt", "updatedAt") VALUES';
const values = [email, password, new Date(), new Date()];
console.log(values) // [ 'test', 'test', '2019-03-01T05:08:34.523Z', '2019-03-01T05:08:34.523Z' ]
return db
.none(query, values)
.then(res => res)
.catch(err => err);
I can insert a row myself using pgAdmin
INSERT INTO "Users" (email, password, "createdAt", "updatedAt") VALUES ('test', 'test', '2019-03-01T05:08:34.523Z', '2019-03-01T05:08:34.523Z');
I've tried using db.one and I've tried a couple of the examples from PostgreSQL Docs but I get the error "message": "syntax error at end of input" from the GraphiQL interface either way. What am I missing here? What is wrong with the input exactly?