Closed johncmunson closed 5 years ago
This is one of the ramifications of save
not being a real "upsert": it doesn't play well with primary keys that aren't generated from sequences or functions. Specifically, it will generate an UPDATE
statement for tables like account
no matter what, since creating a new record means you include an email
. If you have to set a value for the primary key in new records, you need to use insert
, although I note the docs don't currently mention this.
For what it's worth, I have only rarely had reason to prefer a natural over a synthetic key, and emails and other plausibly-mutable facts in particular make bad primary key candidates due to the possibility of breaking external links and references (bookmarks, reports, etc) when they change.
Thanks!!
Summary
Massive appears to successfully be connecting to the database, as witnessed by
req.app.get('db').listTables()
printing out the correct list of database tables. However, any attempts to persist or query data always return null.Example