Drizzle ORM

Column Formats

The format each Drizzle column builder gives the inferred model, per database and column mode.

Each column builder in the @mionjs/drizzle-orm-pg-core, -mysql-core and -sqlite-core packages types its column with the matching format from @mionjs/run-types/formats. The column types (Varchar, Integer, Timestamp and so on) give the same data type from the same arguments, so both forms infer the same rows. These rules apply everywhere:

  • A column declared with an enum keeps drizzle's exact literal union, with no string format on top.
  • A column with no matching format (geometry, vectors, network and binary types, plain booleans and JSON) keeps its plain data type and validates as that primitive.
  • PostgreSQL array columns keep the element format: varchar('codes', {length: 5, array: true}) checks every item against the length. Put array before the other modifiers.

PostgreSQL

BuilderInferred format
varchar (with length)String with maxLength
char (with length)String with exact length
textString
uuidUUID
inetIP
bitString with exact length
integer, serialInt32
smallint, smallserialInt16
bigint, bigserial (mode number)Integer
bigint, bigserial (mode bigint)BigInt64
doublePrecision, realFloat
numeric, decimal (mode number)Float
numeric, decimal (string or bigint mode)plain string or bigint
date (default)StringDate
date (mode date)Date
timeStringTime
timestamp (default)Date
timestamp (mode string)StringDateTime
boolean, json, jsonb, geometry, vectors, macaddr, cidr, interval, point, lineplain data type

MySQL

BuilderInferred format
varchar (length required)String with maxLength
char (with length)String with exact length
text, tinytext, mediumtext, longtextString
intInt32, or UInt32 when unsigned
smallintInt16, or UInt16 when unsigned
tinyintInt8, or UInt8 when unsigned
mediumintits real signed or unsigned window
serialpositive integer
yearinteger in the 1901 to 2155 window
bigint (mode number)Integer
bigint (mode bigint)BigInt64, or BigUInt64 when unsigned
double, float, realFloat
decimal (mode number)Float
decimal (string or bigint mode)plain string or bigint
date, datetime, timestamp (default)Date
date (mode string)StringDate
datetime, timestamp (mode string)StringDateTime
timeStringTime
mysqlEnumthe exact literal union
boolean, json, binary, varbinaryplain data type

SQLite

BuilderInferred format
text (with length)String with maxLength
text (mode json)unknown (use $type for a semantic type)
integer, int (default)Integer
integer, int (mode timestamp)Date
integer, int (mode boolean)plain boolean
realFloat
numeric (mode number)Float
numeric (string or bigint mode)plain string or bigint
blob (mode bigint)BigInt
blob (buffer or json mode)plain Buffer, or unknown for json

Float columns accept whole values like 2.0, and their mock data has fractions.

Copyright © 2026