-
-
Notifications
You must be signed in to change notification settings - Fork 530
Open
Description
When generating models from a PostgreSQL database that includes a column of type INTERVAL, the generated Sequelize model contains invalid code — both in the type and in the defaultValue fields.
Example:
CREATE TABLE some_table (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
waittime INTERVAL DEFAULT INTERVAL '60 seconds',
);The last column will result in:
waittime: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 00:01:00
}Where 00:01:00 should be '60 seconds' instead.
It throws a syntax error and you have to correct it by hand.
These are the parameters i'm using:
sequelize-auto \
-h "$DB_HOST" \
-d "$POSTGRES_DB" \
-u "$POSTGRES_USER" \
-x "$POSTGRES_PASSWORD" \
-p "$DB_PORT" \
--dialect postgres \
--directory /models \
--noInit \
--additional /usr/src/app/additional.json
additional.json
{
"timestamps": true,
"underscored": true,
"createdAt": "created_at",
"updatedAt": "updated_at"
}
Is this a known bug or limitation?
Any workaround?
Metadata
Metadata
Assignees
Labels
No labels