Datatypes
The BLOB datatype allows you to insert data both as strings and as buffers. When you do a find or findAll on a model which has a BLOB column, that data will always be returned as a buffer.
If you are working with the PostgreSQL TIMESTAMP WITHOUT TIME ZONE and you need to parse it to a different timezone, please use the pg library's own parser:
return new Date(stringValue + '+0000');
});
In addition to the type mentioned above, integer, bigint, float and double also support unsigned and zerofill properties, which can be combined in any order:Be aware that this does not apply for PostgreSQL!
Usage in object notation:
// for enums:
MyModel.init({
states: {
values: ['active', 'pending', 'deleted']
}, { sequelize })
Its only supported with PostgreSQL.
Array(Enum) type require special treatment. Whenever Sequelize will talk to database it has to typecast Array values with ENUM name.
Range types
Since range types have extra information for their bound inclusion/exclusion it's notvery straightforward to just use a tuple to represent them in javascript.
When supplying ranges as values you can choose from the following APIs:
However, please note that whenever you get back a value that is range you willreceive:
// stored value: ("2016-01-01 00:00:00+00:00", "2016-02-01 00:00:00+00:00"]
range // [{ value: Date, inclusive: false }, { value: Date, inclusive: true }]