LinkORB Engineering
At LinkORB, we use the schema tool to document databases that our applications rely on. This guide shows how to collaborate with your team members to document databases like a pro š.
Only authorized users can access the schema tool within Team HQ š, and access to particular schemas is granted case-by-case. Request access to specific schemas by contacting your team lead.
Before documenting database schemas using the Schema tool, refer to rules to learn how to write informative descriptions.
Letās explore the different components of the schema tool by creating and editing a schema for a fake e-commerce site called MemeFactory that sells a wide range of āmeme-printedā products such as tee-shirts, coffee mugs, calendars, magnets, wall art, stationery, and greeting cards. Customers can browse and purchase their favorite meme-inspired items, adding a touch of humor and sarcasm to their lives. š
The database associated with this web application is named e-commerce
(since MemeFactory is an e-commerce site).
The name of an application and its associated database name may differ. For example, the plaza
database stores data for the zwangerenportaal application.
Letās create a schema for the e-commerce
database.
Add a schema from the Schemas page and fill in the details using the sample data below.
Field | Enter / Select this value | Optional / Mandatory |
---|---|---|
Name | e-commerce_[YOUR INITIALS] | Mandatory |
Read role | ROLE_USERGROUP:SCHEMATA-TEAM | Mandatory |
Description | Documents MemeFactory's database | Optional |
Append your initials to the schema name as shown in the sample data. For example, e-commerce_MW
reduces the chance of a conflict with another userās schema š.
Right now, our schema looks mighty empty š¤. Ah! That is because we have not added any tables or columns. Letās add a new Orders
table to the schema!
Add a new table from the new e-commerce
schema page and fill in the details using the sample data below.
Field | Enter / select this value | Optional / Mandatory |
---|---|---|
Name | Orders | Mandatory |
Doc Status | DRAFT | Optional |
Description | Stores customer orders | Optional |
For future reference, you may skip the optional fields based on your requirements š.
Our new Orders
table needs some columns. Letās add a new order_number
column that specifies how much meme merch was sold per order.
Add a new column from the new Orders
table page and fill in the details using the sample data below.
Field | Enter / Select this value | Optional / Mandatory |
---|---|---|
Name | order_number | Mandatory |
Type | string | Mandatory |
Nullable | yes | Mandatory |
Length | string(128) | Mandatory |
Doc status | REVIEW | Mandatory |
Try to figure out how to edit the order_number
column and update the length from string(128)
to string(32)
.
You may have noticed that adding tables and columns can be a bit laborious š«. But donāt worry! Fortunately, you also have the option to import a schema in either .csv
or .xml
format.
XML schemas define tables and columns using XML tags, as the following template shows:
<table>
<column/>
<column/>
<column/>
</table>
Letās import a completed e-commerce
schema that includes all the columns and tables we need to complete the rest of the steps.
e-commerce.xml
and paste the following code into it:<?xml version="1.0"?>
<schema>
<table name="Customers" docStatus="INPUT" label="" primaryKeyColumn="customer_id">
<column name="customer_id" type="integer" docStatus="DRAFT" notnull="false"/>
<column name="name" type="string" docStatus="DRAFT" notnull="false"/>
<column name="email" type="string" docStatus="DRAFT" notnull="false"/>
<column name="address" type="string" docStatus="DRAFT" notnull="false"/>
</table>
<table name="Products" docStatus="DRAFT" label="" primaryKeyColumn="product_id">
<column name="product_id" type="integer" comment="PK of the products table." docStatus="REVIEW" notnull="false"/>
<column name="order_item_id" type="integer" docStatus="DRAFT" notnull="false"/>
<column name="order_id" type="integer" docStatus="DRAFT" notnull="false"/>
<column name="quantity" type="integer" docStatus="DRAFT" notnull="false"/>
<column name="price" type="integer" docStatus="DRAFT" notnull="false"/>
</table>
<table name="Orders" docStatus="REVIEW" label="" primaryKeyColumn="order_id">
<column name="order_id" type="integer" comment="uniquely identifies each row." docStatus="REVIEW" notnull="false"/>
<column name="order_date" type="integer" comment="date when order is placed." docStatus="DRAFT" notnull="false"/>
<column name="customer_id" type="integer" docStatus="DRAFT" notnull="false" relation="Customers.customer_id"/>
<column name="order_number" type="string" length="32" comment="Provide feedback on this newly added column." docStatus="REVIEW" notnull="false"/>
</table>
<table name="Payments" docStatus="ACTIVE" label="" primaryKeyColumn="payment_id">
<column name="payment_id" type="integer" docStatus="DRAFT" notnull="false"/>
<column name="order_id" type="integer" docStatus="DRAFT" notnull="false"/>
<column name="payment_method" type="string" docStatus="DRAFT" notnull="false"/>
<column name="amount" type="integer" docStatus="DRAFT" notnull="false"/>
</table>
</schema>
This code is our fully fleshed-out schema that contains all the tables and columns we will work with going forward.
e-commerce
schema page, import the XML schema. You may leave the Upload from Beginning/scratch? ticked.And voilĆ ! š„³
You now know how to import schema tables and columns in bulk like an efficient developer š¤.
In addition to importing schemas, you may also export them to share with others.
If you view the Orders
table, youāll notice we have a few more columns after we imported the XML schema. But something was left out of the XML schema file ā our table needs a primary key to identify each order.
Edit the Orders
table and select order_id
from the Primary Key Column drop-down.
If you look at the table columns again, youāll notice an asterisk * next to the order_id
column to indicate it is the primary key for the Orders
table.
Now each order placed by customers has an order_id
.
A foreign key is a column or group of columns in a relational database table that links data in two tables. You can add foreign keys to a table using the schema tool.
Orders
table page, open customer_id
.The Relational table and Relational column fields specify foreign keys:
Customers
.customer_id
.The Orders
table now uses the customer_id
as its foreign key š«.
Tags are optional but can be helpful. They are usually applied to large databases like onatal, orfeus, and mosos, to name a few. Donāt use tags for small databases like upr
. However, itās okay to tag plaza PII
and subsystems.
Click Tags Types from a schema page to view and create new tags.
Letās look at a few use cases for tags:
Add tags to PII fields to generate input for compliance docs (LinkORB must report which fields it processes and why).
Add tags to fields to be anonymized, stripped, or shuffled before they are sent to analytics databases.
Add tags to application subsystems/components to quickly understand a limited set of tables and columns.
Tag types are schema-level, and you cannot reuse them across schemas.
Use short descriptions for schemas, tables, and columns. Descriptions do not need to be complete sentences.
Start each sentence with a capitalized word and end each sentence with a period since descriptions may require multiple sentences.
There is no need to acknowledge that you are describing a schema, table, or column or that it contains something (since that is obvious). So, remove phrases/words like:
For example, instead of saying:
file_version
- Table that contains file and image metadata.
Focus on what data it stores:
file_version
- File and image metadata.
Provide additional information in a tableās description only if such information is relevant to the whole table. Move all column-specific information to the Comment field of the affected column(s).
Avoid using a columnās Comment section to describe relationships. Instead, document relationships using the Relation fields.
For example, if the id
column of the customer
table has a one-to-one (foreign key) relationship with the customer_id
column of the purchases
table, do not document that relationship in the customer
tableās description like the following example does:
customers
- Customer details.customer.id
usespurchases.customer_id
as its foreign key.
Instead, remove the second sentence:
customer
- Customer details.
Then, set the customer.id
columnās Relation table field to purchases
and the Relation column field to customer_id
.
To write a meaningful description, consider the userās possible questions. For example, for an image_size
column, is the size in bits, bytes, or decimals? Does it represent the original file size or the compressed file size?
When working together to document schemas, use the following workflow as guidance:
Contact the SME to review INPUT
items.
The SME updates the Doc Status to DRAFT
after they have added their input.
Review the DRAFT
items and make updates where necessary.
Change the Doc Status of updated items to REVIEW
.
Consult the project lead for feedback once a schema has been documented thoroughly and is in REVIEW
status.
Change the Doc Status to DRAFT
if any items need more work.
Rinse and repeat.
Remember to follow LinkORBās guidelines for getting help and how to conduct effective asynchronous communication while documenting schemas.
A helpful tip for subject matter experts ā from a schema page, you can view tables and columns with a Doc Status of INPUT
by clicking INPUT LIST.
:::ng database schemas u