Add schemas to data stores
eventcatalog@2.59.0EventCatalog supports any schema format.
When you document your data stores, you may want to include schemas, queries, or other files that explain the data store.
You can attach this information in two ways:
Using codeblocks to render your schema
You can use codeblocks to render your schema directly in your Markdown files.
Here is an example of a SQL codeblock:
```sql
CREATE TABLE users (
id INT PRIMARY KEY,
name VARCHAR(255),
email VARCHAR(255)
);
```
You can learn more about codeblocks and configuring them in the codeblocks documentation.
Using the <Schema/> component to render your schema from a file
If you prefer to keep your schemas or queries in separate files, add them to the data store folder and render them with the <Schema/> component.
<!-- Render the file into your page -->
<Schema file="schema.sql" lang="sql" title="Users Table" />
<!-- Render the schemas separately in an AccordionGroup -->
<AccordionGroup>
<Accordion title="Users Table">
<!-- Load the schema from the file -->
<Schema file="schema.sql" lang="sql" title="Users Table" />
</Accordion>
<Accordion title="Common Queries">
<!-- Load the queries from the file -->
<Schema file="queries.sql" lang="sql" title="Common Queries" />
</Accordion>
</AccordionGroup>
You can see an example of this in the EventCatalog Demo.
Everything in EventCatalog can be versioned. When your data store changes, keep older documentation in a versioned folder and add a changelog.mdx file to explain what changed.