sequelize-date-no-tz-postgres

1.0.0 • Public • Published

sequelize-date-no-tz-postgres

NPM version

Add support for DATE (timestamp without time zone) data-type for PostgreSQL in Sequelize.

Motivation

Read:

Install

npm install --save sequelize-date-no-tz-postgres

Use to define models

models/my_model.js

const withDateNoTz = require('sequelize-date-no-tz-postgres');
 
module.exports = function (sequelize, SequelizeDataTypes) {
  const DataTypes = withDateNoTz(SequelizeDataTypes);
 
  const MyModel = sequelize.define('myModel', {
    someDateWithoutTzField: {
      type: DataTypes.DATE_NO_TZ
    },
 
    // ...
  });
 
  // ...
 
  return MyModel;
};

Use in migrations

migrations/<timestamp>-add-some-date-field-to-my-model.js

const withDateNoTz = require('sequelize-date-no-tz-postgres');
 
module.exports = {
  up: function (queryInterface, SequelizeBase) {
    const Sequelize = withDateNoTz(SequelizeBase);
 
    return queryInterface.addColumn('myModel', 'someDateWithoutTzField', {
      type: Sequelize.DATE_NO_TZ
    });
  },
 
  // ...
};

Package Sidebar

Install

npm i sequelize-date-no-tz-postgres

Weekly Downloads

1,785

Version

1.0.0

License

MIT

Unpacked Size

5.88 kB

Total Files

7

Last publish

Collaborators

  • aosorio