background image

Field types

Every field type, the values it accepts and how it is sent over JSON.

Field types

Overview

Every field has a type. The type decides the column StellarDS.io creates for it, which values the API accepts, and the JSON form values come back in. Send values in exactly these forms; a value that doesn't fit the type is refused with a 400 that names the field, and is never stored as null.

Type Holds JSON form Example
NVarChar(n) text up to n characters (1 to 4,000; default 255) string "Ada Lovelace"
Int, BigInt, SmallInt, TinyInt whole numbers number 42
Real, Float floating-point numbers number 3.14
Decimal(p,s) exact numbers, for money and quantities number 149.50
Boolean true or false boolean true
DateTime a date and time without a time zone ISO 8601 string "2026-10-27T14:30:00"
Date a calendar date yyyy-MM-dd "2026-10-27"
Time a time of day HH:mm:ss, fractions optional "14:30:00"
DateTimeOffset a moment with its UTC offset ISO 8601 with offset "2026-10-27T14:30:00+01:00"
Uuid a globally unique id string "3f2a9c1e-5b7d-4e8a-9c21-7d4e5f6a8b90"
Json a JSON object or array inline JSON { "size": "M", "tags": ["new"] }
Enum one of a fixed list of options string "paid"
Blob a file of up to 1 MB a URL, uploaded through the blob endpoints

Values are read independently of any language or region setting: decimals use a point and no thousands separators, so "149,50" is refused rather than read as 14950.

Decimal

Decimal(p,s) stores numbers exactly. p (precision) is the total number of digits, 1 to 38; s (scale) is how many of them come after the decimal point, 0 up to p. Decimal on its own means Decimal(18,2).

Decimals travel as JSON numbers. A numeric string such as "149.50" is accepted too. A value with more digits after the point than the scale allows, or too many digits in total, is refused instead of rounded.

JavaScript reads every JSON number as a double, so values with more than about 15 significant digits can lose precision in a browser. That is a limit of JSON in JavaScript, not of the stored value.

Dates and times

  • Date and Time come back as "2026-10-27" and "14:30:00", also in custom query results.
  • DateTimeOffset keeps the offset you send. A value without an offset is stored as UTC.
  • DateTime has no time zone. Use DateTimeOffset when the moment matters across time zones.

Uuid

A Uuid field holds a 128-bit id, sent and returned as a string in the usual 8-4-4-4-12 hexadecimal form. Upper or lower case and braces are accepted; values come back in lower case.

Json

A Json field holds a JSON object or array, sent inline:

{ "Name": "T-shirt", "Attributes": { "size": "M", "colors": ["red", "blue"] } }

A string that holds an object or array ("{\"size\":\"M\"}") is accepted too. Plain numbers, strings and booleans are refused: put them in an object.

Json values are compared as text by the database, which would depend on spacing and key order, so a Json field can only be filtered on null or not null.

Enum

An Enum field holds one of its options: a fixed list of strings such as the stages of an order. Options are matched exactly, so "paid" is not "Paid". A value that isn't an option is refused with the options listed.

  • 1 to 200 options per field, each 1 to 100 characters, without line breaks or other control characters.
  • No two options may differ only in case.

Create one by sending options with the field:

curl -X POST "https://api.stellards.io/v1/schema/table/field?project={projectId}&table={tableId}" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Status", "type": "Enum", "options": ["new", "paid", "shipped"] }'

To change the options, send the full new list with PUT /v1/schema/table/field?project={projectId}&table={tableId}&field={fieldId}. An update without options keeps the current ones, so a rename doesn't need them.

When you remove options that records still use, say what those records get instead with replaceOptions: per removed option, a new option or null to clear the value. Without it, the change is refused and nothing is touched.

{
  "name": "Status",
  "type": "Enum",
  "options": ["new", "paid", "sent"],
  "replaceOptions": { "shipped": "sent" }
}

In the console, the field dialog has an options editor and asks the same question when you remove options.

Changing a field's type

You can change a field's type at any time, also when it holds data. StellarDS.io first checks every value and only changes the column when each one converts without changing. Otherwise nothing changes and the error names up to 20 records that are in the way. For example, these changes are refused while such values exist:

  • DateTime to Date when a value has a time other than midnight
  • Float to Decimal(p,s) when a value would be rounded
  • DateTimeOffset to DateTime when a value has an offset other than UTC
  • empty text to a number or a date

Fields become Json or Enum, and stop being one, only through text (NVarChar): text becomes Json when every value is a JSON object or array, and Enum when every value is one of the options. Blob fields can't change type.