dresende/node-sql-query

Enabling use of server side defaults

Closed this issue · 2 comments

An issue was raised in the node-orm2 project where the OP wants to be able to use the server side default column definitions. For instance, in the following table:

CREATE TABLE table1(
    id SERIAL NOT NULL,
    stuff TEXT,
    CONSTRAINT table1_pk PRIMARY KEY (id)
);

He wants to be able to use the series attached to the id key. This is possible in javascript (unlike other languages) by utilizing the javascript undefined object. This would require that undefined and null be treated differently in the PostgreSQL Dialect.

Once this is done, a defaultValue property of undefined in the node-orm2 model would use the server defined default.

dxg commented

Sounds like this is merged & done, so closing.

dresende/node-orm2#485 is required to allow undefined to pass through to the generator.