Files
directus/docs/concepts/types.md
Rijk van Zanten 817ccf3620 Overhaul docs (#3951)
* Add Quickstart Guide

* Update installation

* Remove unused files

* Update support/backing

* Tweaks in concepts

* Setup file structure for API reference 2.0

* Setup page layout for reference

* Add clean-urls plugin

* getting started updates

* Finish authentication rest

* getting started updates

* Render stylus in 2 spaces

* Various

* Various

* Finish activity docs

* Add collections reference

* Add extension reference

* concepts updates

* Fields/tweaks

* Add files doc

* Add revisions

* concepts docs

* More api reference

* Finish rest api reference (finally)

* initial concepts

* More things

* Add assets api ref

* Move sections from file to assets

* Add environment variables

* contributing docs

* Add field transforms page

* Left align table headers

* concept links

* Add API config

* Fix mobile nav

* Add migrating a project

* doc link fixes

Co-authored-by: Ben Haynes <ben@rngr.org>
2021-02-05 18:51:54 -05:00

2.2 KiB

Types

Every Field is configured with a specific "Type" which defines how its data is stored in the database. Often called a data-type, these are important in ensuring field values are saved cleanly and in a standardized format.

When creating a new field you'll be asked to choose a specific data-type. It's important to understand their purpose, because changing them later can cause massive data loss. For that reason, once you set a field's type, it can't be changed from within Directus.

The Type dictates the specific format of a field's value when saving it to the database, helping to keep your data clean, standardized and valid. The type also tells the Directus API how to return your data, for example the CSV type is returned as an array of strings.

Relevant Guides

Directus Data Type Superset

Directus uses its built-in database abstraction to properly support all the different SQL vendors. However, these vendors do not share support for the same datatypes, instead, each SQL vendor maintains their own list. To standardize all of these differences, Directus has a single superset of types that map to the vendor-specific ones.

  • String — A shorter set of characters with a configurable max length
  • Text — A longer set of characters with no real-world max length
  • Boolean — A True or False value
  • Binary — The data of a binary file
  • Integer — A number without a decimal point
  • Big Integer — A larger number without a decimal point
  • Float — A less exact number with a floating decimal point
  • Decimal — A higher precision, exact decimal number often used in finances
  • Timestamp — A date, time, and timezone saved in ISO 8601 format
  • DateTime — A date and time saved in the database vendor's format
  • Date — A date saved in the database vendor's format
  • Time — A time saved in the database vendor's format
  • JSON — A value nested in JavaScript Object Notation
  • CSV — A comma-separated value, returned as an array of strings
  • UUID — A universally unique identifier saved in UUIDv4 format
  • Hash — A string hashed using argon2 cryptographic hash algorithm