question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changing unique ID column name error... (PostgreSQL 9.6.1)

See original GitHub issue

Advanced 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:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
dresendecommented, Mar 1, 2017

Done, dropped gh-pages branch 😉

0reactions
dxgcommented, Mar 1, 2017

Yep. Hey @dresende can we remove those docs somehow? Or point them to the main readme?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found