Numeric, boolean, and string
The exposed-core
module provides support for various numeric, boolean, and string types.
Basic usage
Here's an example of using different data types in a table definition:
Numeric types
integer()
Maps to database
INT
. Used for storing whole numbers within the range of -2^31 to 2^31-1.short()
Maps to database
SMALLINT
. Used for storing smaller whole numbers within the range of -32,768 to 32,767.long()
Maps to database
BIGINT
. Used for storing large whole numbers within the range of -2^63 to 2^63-1.float()
Maps to database
FLOAT
. Used for storing approximate decimal numbers.PostgreSQL: Maps to
REAL
decimal()
Maps to database
DECIMAL
with specified scale and precision. Used for storing exact decimal numbers where precision is important.
Boolean type
bool()
Maps to database
BOOLEAN
. Used for storing true/false values.Database-specific mappings:
Oracle: Maps to
CHAR(1)
SQLServer: Maps to
BIT
String types
char()
Maps to database
CHAR
. Used for storing fixed-length character strings.varchar()
Maps to database
VARCHAR
with specified length. Used for storing variable-length character strings with a maximum length limit.text()
Maps to database
TEXT
. Used for storing large variable-length character strings without length limit.