Skip to content

Commit

Permalink
docs(v6): fix missing information on enums https://github.com/sequeli…
Browse files Browse the repository at this point in the history
  • Loading branch information
fzn0x committed Aug 11, 2022
1 parent 14aec82 commit af639ea
Showing 1 changed file with 41 additions and 10 deletions.
51 changes: 41 additions & 10 deletions versioned_docs/version-6.x.x/other-topics/other-data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,27 @@ Timeline.create({ range: [null, new Date(Date.UTC(2016, 0, 1))] });
Timeline.create({ range: [-Infinity, new Date(Date.UTC(2016, 0, 1))] });
```

## Network Addresses (PostgreSQL only)

```
DataTypes.CIDR // IPv4 or IPv6 host address with Classless Inter-Domain Routing format.
DataTypes.INET // IPv4 or IPv6 host address, and optionally its subnet, all in one field.
DataTypes.MACADDR // MAC addresses.
```

## Arrays (PostgreSQL only)

```typescript
// Defines an array of DataTypes.SOMETHING.
DataTypes.ARRAY(/* DataTypes.SOMETHING */)

// For example
// VARCHAR(255)[]
DataTypes.ARRAY(DataTypes.STRING)
// VARCHAR(255)[][]
DataTypes.ARRAY(DataTypes.ARRAY(DataTypes.STRING))
```

## BLOBs

```js
Expand Down Expand Up @@ -179,16 +200,26 @@ await User.findAll({
})
```

## Others
## Miscellaneous DataTypes

```js
DataTypes.ARRAY(/* DataTypes.SOMETHING */) // Defines an array of DataTypes.SOMETHING. PostgreSQL only.
<DialectTableFilter>

DataTypes.CIDR // CIDR PostgreSQL only
DataTypes.INET // INET PostgreSQL only
DataTypes.MACADDR // MACADDR PostgreSQL only
| Sequelize DataType | PostgreSQL | [MariaDB](https://mariadb.com/kb/en/geometry-types/) | [MySQL](https://dev.mysql.com/doc/refman/8.0/en/spatial-type-overview.html) | MSSQL | SQLite | Snowflake | db2 | ibmi |
|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|------------------------------------------------------|-----------------------------------------------------------------------------|-------|--------|-----------|-----|------|
| [`GEOMETRY`](pathname:///api/v7/interfaces/DataTypes.GeometryDataTypeConstructor.html) | [`GEOMETRY`](https://postgis.net/workshops/postgis-intro/geometries.html) | `GEOMETRY` | `GEOMETRY` ||||||
| `GEOMETRY('POINT')` | `GEOMETRY(POINT)` | `POINT` | `POINT` ||||||
| `GEOMETRY('POINT', 4326)` | `GEOMETRY(POINT,4326)` ||||||||
| `GEOMETRY('POLYGON')` | `GEOMETRY(POLYGON)` | `POLYGON` | `POLYGON` ||||||
| `GEOMETRY('LINESTRING')` | `GEOMETRY(LINESTRING)` | `LINESTRING` | `LINESTRING` ||||||
| [`GEOGRAPHY`](pathname:///api/v7/interfaces/DataTypes.GeographyDataTypeConstructor.html) | [`GEOGRAPHY`](https://postgis.net/workshops/postgis-intro/geography.html) ||||||||
| `HSTORE` | [`HSTORE`](https://www.postgresql.org/docs/9.1/hstore.html) ||||||||

DataTypes.GEOMETRY // Spatial column. PostgreSQL (with PostGIS) or MySQL only.
DataTypes.GEOMETRY('POINT') // Spatial column with geometry type. PostgreSQL (with PostGIS) or MySQL only.
DataTypes.GEOMETRY('POINT', 4326) // Spatial column with geometry type and SRID. PostgreSQL (with PostGIS) or MySQL only.
```
</DialectTableFilter>

:::note

In Postgres, the GEOMETRY and GEOGRAPHY types are implemented by [the PostGIS extension](https://postgis.net/workshops/postgis-intro/geometries.html).

In Postgres, You must install the [pg-hstore](https://www.npmjs.com/package/pg-hstore) package if you use `DataTypes.HSTORE`

:::

0 comments on commit af639ea

Please sign in to comment.