Tables in Rocket
Tables are the cornerstone of your Rocket database, defining your data's structure and the specific operations it supports. This documentation will guide you through effective table management.
Creating a New Table
For detailed instructions on creating a new table, please refer to the Creating Tables section in the documentation.
Managing Existing Tables
Once you've created tables and defined attributes, you can efficiently manage them:
Editing Table Attributes: To modify an existing table's structure or properties, navigate to the "Tables" section, select the table you want to modify, and click the "Edit" button.
Deleting a Table: If you no longer need a table, you can delete it. However, exercise caution as this action is irreversible. Navigate to the "Tables" section, select the table you wish to delete, and click the "Delete" button.
Data Types
Rocket supports various data types, allowing you to tailor your database to your specific needs. Here is a list of the supported data types in Rocket:
Data Type | Description | Length Constraints |
---|---|---|
Integer | This data type is designed for storing numbers and supports both negative and positive integers, as well as numbers with decimal points. | |
Boolean | You can store Boolean values, representing both "true" and "false." | |
String | Store simple text strings, with optional length constraints. | Min Length: 0, Max Length: 255 |
Large-Text | Store lengthy text, with optional length constraints. | Min Length: 0, Max Length: 4096 |
Supported Operations
Rocket provides support for various operations on attributes:
Unique
Marking an attribute as unique designates its data as unique. This means it will not allow any duplicate values.
Indexable
Designating an attribute as indexable enables Rocket to automatically generate APIs for retrieving data based on that attribute. If the attribute is not unique, it may retrieve multiple rows of data.
When the "id" attribute of a table is marked as indexable, Rocket generates an API endpoint in the format "/{databaseId}/{tableId}/{attributeName}/{attributeValue}."
Searchable
Indicating that an attribute is searchable results in Rocket generating APIs for searching data using that attribute.
For instance, selecting the "name" attribute leads to the creation of an API endpoint in the format "/{databaseId}/{tableId}/search/{attributeName}?query={attributeValue}." This allows for data searches based on the specified attribute and query value.
Sortable
Marking an attribute as sortable indicates that it can be used for sorting data. If an attribute is sortable, it will update all the GET APIs and add an optional sorting query parameter.
Editable
This attribute determines if it can be used to identify data for updating. If the attribute is not unique, it may update multiple rows of data.
An API in this format is created: "PUT /{databaseId}/{tableId}/{attributeName}/{attributeValue}."
Deletable
This attribute indicates if it can be used to identify data for deletion. If the attribute is not unique, it may delete multiple rows of data.
An API in this format is created: "DELETE /{databaseId}/{tableId}/{attributeName}/{attributeValue}."
Field Validations
Field | Data Type | Min Length | Max Length | Options | Default | Extra Details |
---|---|---|---|---|---|---|
name | String | 2 | 25 | - | - | - |
subtitle | String | 5 | 255 | - | - | - |
attribute.name | String | 2 | 25 | - | - |
|
attribute.dataType | Enum | - | - | 'string', 'number', 'boolean', 'large-text' | - | - |
attribute.description | String | 5 | 255 | - | - | - |
attribute.unique | Boolean | - | - | true, false | - | - |
attribute.indexable | Boolean | - | - | true, false | - | - |
attribute.searchable | Boolean | - | - | true, false | - | - |
attribute.sortable | Boolean | - | - | true, false | - | - |
attribute.editable | Boolean | - | - | true, false | - | - |
attribute.deletable | Boolean | - | - | true, false | - | - |