Getting Started with Table / Entity Definitions in Onyx Database

Welcome to the Onyx Database entity definitions tutorial! This guide will walk you through the process of defining entities for both the Open Source and Cloud versions. You'll learn how to specify entities, identifiers, attributes, relationships, and indexes to model your data effectively.

Index Definition

Indicating an index is as easy as identifying an existing attribute as an index. An index definition must be. You cannot define an index as a relationship.

Indexes can have the following types:

TypeDescriptionMin/Max

String

UTF-8 Encoded TextN/A

Integer

Mutable Integer (can be null)-2147483648 to 2147483647

int

Immutable Integer (cannot be null)-2147483648 to 2147483647

Long

Mutable Long (can be null)-9223372036854775808 to 9223372036854775807

long

Immutable Long (cannot be null)-9223372036854775808 to 9223372036854775807

Double

Mutable Double (can be null)4.9E-324 to 1.7976931348623157E308

double

Immutable Double (cannot be null)4.9E-324 to 1.7976931348623157E308

Boolean

Mutable Boolean (can be null)true/false

boolean

Immutable Boolean (cannot be null)true/false

Date

Java Date TimeSun Dec 02 16:47:04 GMT 292269055 - Sun Aug 17 07:12:55 GMT 292278994

Float

Java Float primitive or mutable0.0

Byte

Java Byte primitive or mutable0

Short

Java Short primitive or mutable0

Index Annotation Examples

1indexes: [
2    {
3        "name": "emailIndex",
4    }
5]

Next Steps

Now that you have learned how to define indexes within your model, you can explore an example migration.

Need Help?

For further assistance, please contact our support team at [email protected].