HCL Column Types
The following guide describes the column types supported by Atlas HCL, and how to use them.
MySQL
Bit
The bit type allows creating BIT columns.
An optional size attribute allows controlling the number of bits stored in a column, ranging from 1 to 64.
table "t" {
schema = schema.test
column "c1" {
type = bit
}
column "c2" {
type = bit(4)
}
}
Binary
The varbinary and binary types allow storing binary byte strings.
table "t" {
schema = schema.test
column "c1" {
// Equals to binary(1).
type = binary
}
column "c2" {
type = binary(10)
}
column "c3" {
type = varbinary(255)
}
}
Blob
The tinyblob, mediumblob, blob and longblob types allow storing binary large objects.
table "t" {
schema = schema.test
column "c1" {
type = tinyblob
}
column "c2" {
type = mediumblob
}
column "c3" {
type = blob
}
column "c4" {
type = longblob
}
}
Boolean
The bool and boolean types are mapped to tinyint(1) in MySQL. Still, Atlas allows maintaining columns of type bool
in the schema for simplicity reasons.
table "t" {
schema = schema.test
column "c1" {
type = bool
}
column "c2" {
type = boolean
}
}
Learn more about the motivation for these types in the MySQL website.