Managing Your Database Schema

This guide will walk you through the processes of managing your database schema using the Onyx Cloud Database dashboard. You will learn how to edit your schema, define identifiers, set partitions, manage indexes, validate your schema, and publish changes to ensure your database remains consistent and efficient.

Introduction

Managing your database schema is crucial for maintaining the integrity and performance of your applications. This guide covers the essential steps to effectively manage, validate, and publish your schema changes.

Accessing the Schema Editor

To begin managing your schema, access the Schema Editor through your dashboard.

1

Navigate to the Dashboard

Log in to your Onyx Cloud Database account and navigate to the Dashboard.

Dashboard Overview
2

Select Your Database

From the dashboard, select the database you wish to manage from the list of your databases.

3

Open the Schema Editor

Click on the Schema Editor tab to open the interface where you can manage your database schema.

Schema Editor

Managing Your Schema

The Schema Editor allows you to add, modify, or remove tables and their attributes to define the structure of your database.

1

Add a New Table

Click on the Add Table button to create a new table in your schema.

New Table Form
2

Define Table Attributes

Within the new table, define its attributes by specifying the name, type, and other properties.

3

Set Relationships

Establish relationships between tables by defining foreign keys and specifying relationship types.

4

Save Changes

After making your changes, ensure you save them by clicking the Validate button. In order to save the schema you must publish the schema.

Defining Identifiers

Identifiers are essential for uniquely identifying records within a table. Defining a primary key ensures data integrity and optimizes query performance.

1

Select Identifier Attribute

In the Schema Editor, navigate to the Identifier section. Select an attribute to serve as the primary identifier from the dropdown menu.

2

Choose Identifier Generator

Choose an appropriate generator for your identifier. Options typically include:

  • None: Manually manage identifiers.
  • UUID: Automatically generate unique identifiers.
  • Auto-Increment: Automatically increment numerical identifiers.
3

Save Identifier Settings

After selecting the identifier attribute and generator, click Publish to apply the changes.

Setting Partitions

Partitioning helps in organizing data efficiently, improving query performance, and managing data lifecycle.

1

Navigate to Partition Section

In the Schema Editor, locate the Partition section within the table you are managing.

2

Select Partition Attribute

Choose an attribute to partition the table. This attribute should align with your data access patterns and scalability requirements.

3

Apply Partition Settings

After selecting the partition attribute, click Publish to apply the partition settings to your table.

Managing Indexes

Indexes improve the speed of data retrieval operations on your database tables. Proper indexing is vital for query optimization and overall database performance.

1

Access Indexes Section

Within the Schema Editor, navigate to the Indexes section of the table you wish to index.

2

Add a New Index

Click on the Add Index button to create a new index.

3

Define Index Attributes

Specify the index name and select one or more attributes that the index will cover. Ensure that the selected attributes align with your query patterns.

4

Save Index Settings

After defining the index attributes, click Publish to apply the index to your table.

Validating Your Schema

Validation ensures that your schema adheres to the required standards and constraints before publishing.

1

Initiate Validation

After making changes to your schema, click on the Validate button to initiate the validation process.

2

Review Validation Results

Upon completion, review the validation results. If there are errors or warnings, address them accordingly.

3

Resolve Issues

Make necessary adjustments to your schema based on the validation feedback and re-validate until your schema is error-free.

Publishing Your Schema

Once your schema is validated, you can publish it to apply the changes to your live database.

1

Open Publish Modal

Click on the Publish button to open the publishing modal.

2

Enter Revision Description

In the modal, provide a Revision Description detailing the changes being published.

Publish Button
3

Confirm Publishing

After entering the revision description, click on the Publish button to apply the changes.

4

Review Published Schema

Once published, review the updated schema to ensure all changes have been applied correctly.

Next Steps

Need Help?

If you have any questions or need assistance: