* When defining a model you can just as easily pass a string as type, but often using the types defined here is beneficial. For example, using `DataTypes.BLOB`, mean
* that that column will be returned as an instance of `Buffer` when being fetched by sequelize.
*
*
* Some data types have special properties that can be accessed in order to change the data type. For example, to get an unsigned integer with zerofill you can do `DataTypes.INTEGER.UNSIGNED.ZEROFILL`.
* The order you access the properties in do not matter, so `DataTypes.INTEGER.ZEROFILL.UNSIGNED` is fine as well. The available properties are listed under each data type.
*
* To provide a length for the data type, you can invoke it like a function: `INTEGER(2)`
*
* Three of the values provided here (`NOW`, `UUIDV1` and `UUIDV4`) are special default values, that should not be used to define types. Instead they are used as shorthands for
* Three of the values provided here (`NOW`, `UUIDV1` and `UUIDV4`) are special default values, that should not be used to define types. Instead they are used as shorthands for
* defining default values. For example, to get a uuid field with a default value generated following v1 of the UUID standard:
* ```js
* sequelize.define('model', {
* uuid: {
* type: DataTypes.UUID,
* defaultValue: DataTypes.UUIDV1,
* primaryKey: true
* primaryKey: true
* }
* })
* ```
...
...
@@ -315,11 +315,11 @@ module.exports = {
* @property STRING
*/
STRING:STRING,
/**
/**
* A fixed length string. Default length 255
*
* Available properties: `BINARY`
*
*
* @property CHAR
*/
CHAR:CHAR,
...
...
@@ -361,7 +361,7 @@ module.exports = {
BOOLEAN:'TINYINT(1)',
/**
* Floating point number. Accepts one or two arguments for precision
*
*
* Available properties: `UNSIGNED`, `ZEROFILL`
*
* @property FLOAT
...
...
@@ -380,7 +380,7 @@ module.exports = {
BLOB:BLOB,
/**
* Decimal number. Accepts one or two arguments for precision
*
*
* Available properties: `UNSIGNED`, `ZEROFILL`
*
* @property DECIMAL
...
...
@@ -416,7 +416,7 @@ module.exports = {
/**
* A virtual value that is not stored in the DB. This could for example be useful if you want to provide a default value in your model
* that is returned to the user but not stored in the DB.
*
*
* You could also use it to validate a value before permuting and storing it. Checking password length before hashing it for example: