Database Schema
An ER-style diagram showing database tables, columns, and relationships. This is similar to what the Database Integration feature generates automatically.
# E-Commerce Database Schema
table id="users" { column title="users" icon="https://cdn.simpleicons.org/postgresql" { id (PK) email (UNIQUE) password_hash name created_at updated_at }}
table id="products" { column title="products" icon="https://cdn.simpleicons.org/postgresql" { id (PK) name description price (DECIMAL) category_id (FK) created_at }}
table id="categories" { column title="categories" icon="https://cdn.simpleicons.org/postgresql" { id (PK) name slug (UNIQUE) parent_id (FK, self-ref) }}
table id="orders" { column title="orders" icon="https://cdn.simpleicons.org/postgresql" { id (PK) user_id (FK) status (ENUM) total (DECIMAL) created_at updated_at }}
table id="order_items" { column title="order_items" icon="https://cdn.simpleicons.org/postgresql" { id (PK) order_id (FK) product_id (FK) quantity (INT) unit_price (DECIMAL) }}
table id="reviews" { column title="reviews" icon="https://cdn.simpleicons.org/postgresql" { id (PK) user_id (FK) product_id (FK) rating (INT) comment (TEXT) created_at }}
# Foreign Key Relationshipsedge from="orders" to="users" label="user_id"edge from="order_items" to="orders" label="order_id"edge from="order_items" to="products" label="product_id"edge from="products" to="categories" label="category_id"edge from="categories" to="categories" label="parent_id" style="dashed"edge from="reviews" to="users" label="user_id"edge from="reviews" to="products" label="product_id"Patterns Demonstrated
Section titled “Patterns Demonstrated”- Tables with single columns — each table element represents a database table
- Column items listing fields with type annotations
- Edges as foreign keys — labeled with the FK column name
- Self-referential edge —
categories.parent_id→categories(dashed) - Consistent iconography — all tables use the PostgreSQL icon
Auto-Generation
Section titled “Auto-Generation”Instead of writing schema diagrams by hand, you can connect your database directly using the Database Integration feature. Topolix will introspect your schema and generate a diagram like this automatically.