Add support for TIME (without time zone) data-type for PostgreSQL in Sequelize.
Read:
npm install --save sequelize-time-no-tz-postgres
models/my_model.js
const withTimeNoTz = require('sequelize-time-no-tz-postgres');
module.exports = function (sequelize, SequelizeDataTypes) {
const DataTypes = withTimeNoTz(SequelizeDataTypes);
const MyModel = sequelize.define('myModel', {
someTimeWithoutTzField: {
type: DataTypes.TIME_NO_TZ
},
// ...
});
// ...
return MyModel;
};
migrations/<timestamp>-add-some-time-field-to-my-model.js
const withTimeNoTz = require('sequelize-time-no-tz-postgres');
module.exports = {
up: function (queryInterface, SequelizeBase) {
const Sequelize = withTimeNoTz(SequelizeBase);
return queryInterface.addColumn('myModel', 'someTimeWithoutTzField', {
type: Sequelize.TIME_NO_TZ
});
},
// ...
};