Skip to content

Latest commit

 

History

History
44 lines (27 loc) · 859 Bytes

ReadMe.md

File metadata and controls

44 lines (27 loc) · 859 Bytes

sequelizex

some useful utilities for sequelize, such as simeple datatype.

Installation

  npm install sequelize-x

simpel Datatype

var sequelizex = require('sequelize-x');
var shortDataTypes = sequelizex.DataTypes;

module.exports = function (sequelize, DataTypes) {

  var Model = sequelize.define('Model', {

    string: shortDataTypes.String(),
    stringWithMaxlength: shortDataTypes.String(256),
    stringAllowNull: shortDataTypes.String(null, true),

    double: shortDataTypes.Double(),
    doubleWithCustomDefaultValue: shortDataTypes.Double(10),

    int: shortDataTypes.Int(),
    intWithCustomDefaultValue: shortDataTypes.Int(10),

    phone: shortDataTypes.Phone(true),
    phoneAllowNull: shortDataTypes.Phone(true),

    text: shortDataTypes.Text(),

    time: shortDataTypes.Date(),
  });

  return Model;
};