不要怂,就是干,撸起袖子干!

data-types.js 578 Bytes
'use strict';

var DataTypes = require('../../data-types');

//drop table Group
DataTypes.BOOLEAN = 'BIT';
DataTypes.NOW = 'GETDATE()';
DataTypes.UUID = 'CHAR(36)';
DataTypes.BLOB = 'VARBINARY(MAX)';
DataTypes.STRING._typeName = 'NVARCHAR';

DataTypes.STRING.prototype = {
  get BINARY() {
    this._binary = true;
    return this;
  },
  get type() {
    return this.toString();
  },
  toString: function() {
    if(!this._binary){
      return 'NVARCHAR(' + this._length + ')';
    }else{
      return 'BINARY(' + this._length + ')';
    }
  }
};

module.exports = DataTypes;