OriginChainDB

Understand schemas

Decide what each record contains before you save it.

A schema names the fields in a table and the values each field accepts.

A table is a collection of records.Example: shop.products
idnameprice_cents
p001Travel mug1990
p002Desk lamp3500
Column A field, such as name.Row One product.Primary key An ID that is unique.

Choose how to create it

Make three decisions before saving a tableThe schema defines what records may contain; it does not add the records themselves.
  1. Name the tableChoose its namespace and a clear table name.
  2. Choose the primary keyDecide which field uniquely identifies each record.
  3. Define the fieldsChoose names, types and required values.
  4. Save and inspect the definitionConfirm the table exists before loading data.

Start with three decisions

DecideExampleMeaning
Where the table belongsshop.customersshop groups related tables; customers names this table.
How to identify a recordidThe primary key is the field that uniquely identifies each customer.
What to storeid, email, signup_msEach column has a name and a type, such as text or a whole number.
See this table as a schema file

Save the following as manifest.toml. TOML is a text format for configuration.

namespace   = "shop"
table       = "customers"
primary_key = ["id"]

[[columns]]
name = "id"
ty   = "str"
required = true

[[columns]]
name = "email"
ty   = "str"

[[columns]]
name = "signup_ms"
ty   = "u64"
  • str accepts text. u64 accepts non-negative whole numbers.
  • required = true means the record must include that field.
  • Each [[columns]] block adds one field to the table.

Choose suitable field types

Start with text, numbers and yes/no values. Use a more specific type when you need validation for dates, identifiers or other structured values.

  • Names and email addresses: str.
  • Whole numbers: i64 or u64, depending on whether negatives are allowed.
  • Yes/no values: bool.
  • Money: decimal, or integer minor units such as cents. Avoid floating-point rounding.

The type reference lists the accepted formats and additional settings.

Save the definition

In the console, review and save the table definition. If you use a TOML file, submit it through the schema registration API.

After the request succeeds, check that the table appears before adding records. A schema defines the table; it does not add customer data.

Add rules when you need them

NeedAdd
Find rows by a frequently searched fieldAn index.
Follow links between recordsA relation.
Require a referenced record to existA foreign key.
Reject values that break a ruleA check constraint.

Keep search indexes in mind

Saving a row does not automatically create its vector embedding or full-text index. Those use separate operations, linked to the record by its ID.

See vector schemas or full-text indexing when you add those search methods.

Next step

Create your first schema, or look up a specific setting in the schema reference.

© 2026 Silicoyn Technologies Pvt Ltd

On this page