- Team Databases
- Creating a Team Database
- Exporting a Team Database
- Creating/Retrieving/Updating Database Records
- Schemas
- Default Schema
- Required Fields
- Additional Properties
- Enforcing a Schema
Team Databases
PixieBrix supports Team Database for storing data across mod runs, browsers, and team members.
A team database is a key-value store. Each record is referenced by a unique key, and stores a JSON object.
Creating a Team Database
To create a Team Database, open the Databases screen from the side nav.
Then, click the Create Database button:
Exporting a Team Database
PixieBrix supports exporting a Team Database as:
- CSV
- JSON
To export a database, click the Export button on the Databaseās detail page:
In the modal, optionally select a date range to export:
Creating/Retrieving/Updating Database Records
Team Database records can be used within PixieBrix mods or with the Developer API
PixieBrix marketplace listing for database bricks:
Schemas
By default, Team Databases allow any shape of data to be stored in the database. However, you can also set a schema for the database, and optionally enforce that schema.
A schema describes the data shape and types that are contained in the Database.
In PixieBrix, database schemas are defined using the JSON Schema standard (the same standard used for defining brick input and output schemas in PixieBrix).
Default Schema
The default schema allows objects of any shape to be stored:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {},
"additionalProperties": true
}
Required Fields
To require fields, use JSON Schemaās required attribute. For example:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"example": {
"type": "string"
}
},
"required": ["example"],
"additionalProperties": true
}
Additional Properties
By default, JSON Schema objects allows additional fields that arenāt defined on the schema. To forbid additional properties, set additionalProperties: false
Forbidding additional properties is useful for preventing errors due to field name typos/misspelled fields
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"example": {
"type": "string"
}
},
"required": ["example"],
"additionalProperties": false
}
Enforcing a Schema
To enforce a schema, toggle the āEnforce schemaā toggle on the Database detail screenās Schema tab:
When using the shallow
, deep
, and deep_append
merge strategies, PixieBrix enforces the schema for the resulting data (i.e., as opposed to the partial data in the update).