Database Diagram Tool - dbdocs.io
Here is another documentation tool that uses the DBML format.
Steps
First install the CLI tool
sudo npm install -g dbdocs
Then you will need to login. Unfortunately, the only way to do this is through your Github account.
dbdocs login
Create your database document, or copy it over from when using dbdiagram.io
editor database.dbml
When you've finished creating the document, or made some changes, publish it with:
dbdocs build database.dbml
Set Password
You probably want to set a password so that only people you share this with can view your documentation:
dbdocs \
password --set "passwordGoesHere" \
--project "My Project Name"
database.dbml
file and it pull the project name from there.
Spaces In Name
You can have spaces in your project name by using quotes. E.g.
Project "My Project Name" {
database_type: 'PostgreSQL'
Note: 'A database for the project'
}
Markdown In Document Note
You can have markdown in your document note. E.g.
Project "My Project Name" {
database_type: 'PostgreSQL'
Note: '''
# My Project Name
This is the database schematic is for ....
'''
}
Defining Table Note
Add the following to your table
note: 'My note goes here.'
'''
Specifying Null or Not Null
Table orders {
id int [primary key]
user_id int [not null]
status varchar
created_at varchar [null, note: 'When this order was created']
}
Notes
- I really love that when you are in the default "Table Structure" view, you click on a table in the left-hand pane, you only see the tables that relate to it. Thus if working on a database with a LOT of tables, you don't become overwhelmed trying to find your table in the graphical view.
References
First published: 12th May 2021