I have a node.js application using sequelize as an ORM, which should create tables if they don't exist on a local postgres development database.
The queries created by sequelize all fail where there are timestamp columns such as 'created' or 'modified' that should take the time a record is created as a default.
The sequelize generated query for create table includes a GETDATE() function for such fields.
Pasting the queries into the PGAdmin tool throws the same error with GETDATE(), as is console logged in node.js.
I can manually change the query in PGAdmin to the NOW() function but this is frustrating given my schema contains multiple tables having such columns.
Is there a fix for this issue?
Below are the versions of sequelize, pg and pg-hstore
"pg": "^8.11.1", "pg-hstore": "^2.3.4" "sequelize": "^6.32.1"
Version of postgres is "PostgreSQL 15.3, compiled by Visual C++ build 1914, 64-bit"
You can define the model has follows:
Using that way you override the default Sequelize functionality