Skip to content

Commit 0b23400

Browse files
Added range examples in docs (model definition section)
1 parent 5a046e3 commit 0b23400

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

docs/docs/models-definition.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var Foo = sequelize.define('Foo', {
3737
someUnique: {type: Sequelize.STRING, unique: true},
3838
uniqueOne: { type: Sequelize.STRING, unique: 'compositeIndex'},
3939
uniqueTwo: { type: Sequelize.INTEGER, unique: 'compositeIndex'}
40-
40+
4141
// The unique property is simply a shorthand to create a unique index.
4242
someUnique: {type: Sequelize.STRING, unique: true}
4343
// It's exactly the same as creating the index in the model's options.
@@ -118,6 +118,14 @@ Sequelize.BLOB // BLOB (bytea for PostgreSQL)
118118
Sequelize.BLOB('tiny') // TINYBLOB (bytea for PostgreSQL. Other options are medium and long)
119119

120120
Sequelize.UUID // UUID datatype for PostgreSQL and SQLite, CHAR(36) BINARY for MySQL (use defaultValue: Sequelize.UUIDV1 or Sequelize.UUIDV4 to make sequelize generate the ids automatically)
121+
122+
Sequelize.RANGE(Sequelize.INTEGER) // Defines int4range range. PostgreSQL only.
123+
Sequelize.RANGE(Sequelize.BIGINT) // Defined int8range range. PostgreSQL only.
124+
Sequelize.RANGE(Sequelize.DATE) // Defines tstzrange range. PostgreSQL only.
125+
Sequelize.RANGE(Sequelize.DATEONLY) // Defines daterange range. PostgreSQL only.
126+
Sequelize.RANGE(Sequelize.DECIMAL) // Defines numrange range. PostgreSQL only.
127+
128+
Sequelize.ARRAY(Sequelize.RANGE(Sequelize.DATE)) // Defines array of tstzrange ranges. PostgreSQL only.
121129
```
122130

123131
The BLOB data type 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.

0 commit comments

Comments
 (0)