Changing unique ID column name error... (PostgreSQL 9.6.1)
See original GitHub issueAdvanced Options (from wiki)
var Person = db.define("person", {
name : String
}, {
id : "person_id"
});
Cannot get this to work (from example, with added modification):
module.exports = function(orm, db) {
var Message = db.define('message', {
title: { type: 'text', required: true },
body: { type: 'text', required: true, big: true },
createdAt: { type: 'date', required: true, time: true }
}, {
**id: "message_id",**
hooks: {
...
Error message:
throw new ORMError(“Model defined without any keys”, ‘BAD_MODEL’, { model: opts.table });
This works just fine:
db.settings.set("properties.primary_key", "message_id");
Thank you for any help you can provide.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
docker: postgreSQL changed from ver 9.6 to 10.3 compatibility ...
ERROR : column "id" referenced in foreign key constraint does not exist STATEMENT: CREATE TABLE package ( id SERIAL NOT NULL, name ......
Read more >E.25. Release 9.6 - PostgreSQL
Change a column name in the information_schema.routines view from result_cast_character_set_name to result_cast_char_set_name (Clément ...
Read more >PostgreSQL "Column does not exist" but it actually does
This problem occurs in postgres because the table name is not tablename instead it is "tablename". for eg.
Read more >Waiting for PostgreSQL 10 – Identity columns - Depesz
Identity columns This is the SQL standard-conforming variant of PostgreSQL's ... ERROR: duplicate key value violates unique constraint ...
Read more >'Column reference is ambiguous' when upserting element into ...
I tried to use this query, but when I run it, it errors with Column reference 'affiliate_code' is ambiguous : INSERT INTO accounts...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Done, dropped gh-pages branch 😉
Yep. Hey @dresende can we remove those docs somehow? Or point them to the main readme?