Type mapping
This is the exhaustive matrix from each s builder to its SurrealQL TYPE, with a support status. For builder signatures see Schema builders; for how types compose into DDL see from schema to DDL.
Field types
Supported Partial / lossy Schema-layer gap
s.* SurrealQL TYPE STATUS NOTES
s.string() string OK
s.boolean() bool OK
s.number() number OK
s.int() / int32() / uint32() int OK
s.float() float OK
s.bigint() int OK Stored as a SurrealDB int.
s.decimal() decimal OK
s.datetime() datetime OK Codec: Date <-> DateTime.
s.duration() duration OK Native Duration, no conversion.
s.uuid() uuid OK Codec: string <-> Uuid.
s.bytes() bytes OK Uint8Array; normalizes ArrayBuffer on decode.
s.file() file OK Native FileRef.
s.geometry(kind) geometry<kind> OK
User.record() record<user> OK Codec: record link, built from the imported table def.
String formats
Each is a string carrying an ASSERT. The full list is in Schema builders.
Supported Partial / lossy Schema-layer gap
s.* SurrealQL TYPE STATUS NOTES
s.email() string OK ASSERT string::is_email($value).
s.url() / ipv4() / ipv6() / semver() / … string OK ASSERT the matching string::is_* check.
Structural types
Supported Partial / lossy Schema-layer gap
s.* SurrealQL TYPE STATUS NOTES
s.object({ ... }) object OK Each key becomes a DEFINE FIELD.
s.array(el, { max }) array<el> OK
s.set(el) set<el> OK
s.record(k, v) / s.map(...) object OK A keyed map.
s.tuple([...]) array Partial Stored as an array; per-position types validate in app.
s.union([...]) / discriminatedUnion(...) <a> | <b> OK
s.literal(v) / enum([...]) <value> | union OK
s.intersection(a, b) object OK Merged object types.
s.lazy(() => ...) (recursive) OK
s.any() / unknown() any OK
Modifiers
Supported Partial / lossy Schema-layer gap
s.* SurrealQL TYPE STATUS NOTES
.optional() option<T> OK
.nullable() T | null OK
.array() array<T> OK
.loose() FLEXIBLE object OK
Not yet covered
These SurrealQL features are on the roadmap but not expressible in the schema today. Do not rely on them yet:
- Record references with cascade:
record<...> REFERENCE ... ON DELETE. - Full-text and vector indexes: only standard and unique indexes are emitted.
DEFINE PARAMandDEFINE SEQUENCE.
One round-trip caveat: schemic pull reconstructs s.email() and s.uuid() fields from the database as a plain string with the matching ASSERT, not as the original codec field, because introspection sees only the DDL.
Where to go next
- Schema builders — the builder signatures.
- From schema to DDL — how these compose.
- Codecs — the conversions behind the codec types.