Schema Example for Onyx Cloud Database
Use this example as a reference for how tables, identifiers, attributes, and metadata fit together in the schema JSON editor.
Introduction
This customer-focused schema shows a UUID identifier, a partition attribute, and the supporting metadata that appears in the admin console schema editor.
Example Schema
1{
2 "tables": [
3 {
4 "name": "Customer",
5 "identifier": {
6 "name": "customerId",
7 "type": "String",
8 "generator": "UUID"
9 },
10 "partition": "countryCode",
11 "attributes": [
12 {
13 "name": "customerId",
14 "type": "String"
15 },
16 {
17 "name": "firstName",
18 "type": "String"
19 },
20 {
21 "name": "lastName",
22 "type": "String"
23 },
24 {
25 "name": "email",
26 "type": "String"
27 },
28 {
29 "name": "age",
30 "type": "Int"
31 },
32 {
33 "name": "dateCreated",
34 "type": "Timestamp"
35 },
36 {
37 "name": "isActive",
38 "type": "Boolean"
39 },
40 {
41 "name": "balance",
42 "type": "Float"
43 },
44 {
45 "name": "profilePic",
46 "type": "EmbeddedObject"
47 },
48 {
49 "name": "countryCode",
50 "type": "String"
51 }
52 ],
53 "indexes": [],
54 "resolvers": [],
55 "triggers": [],
56 "expanded": false,
57 "isEditing": false
58 }
59 ],
60 "revisionDescription": "Customer table created with UUID‑generated immutable `customerId`, required attributes, partitioned by `countryCode`, indexed `email`, and an `orders` resolver that lazily fetches",
61 "schemaId": 0,
62 "timestamp": ""
63}Legend
tables: Array of table definitions in the schema.name: The table name (entity name) for the data model.identifier: Primary key configuration, including the identifier field, data type, and generator strategy.partition: Attribute used to shard or partition records.attributes: Column definitions, each with anameandtypedescribing the stored fields.indexes: List of index definitions for faster lookups.resolvers: Computed fields or joins that fetch related data.triggers: Hooks that run on schema events (create/update/delete).expandedandisEditing: UI state flags used in the schema editor.revisionDescription: Human-readable summary of the schema revision.schemaIdandtimestamp: Metadata for identifying the revision and when it was saved.
Next Steps
Need Help?
If you have any questions or need assistance:
- Email:support@onyx.dev
- Documentation: Visit ourHelp Centerfor tutorials and FAQs.