Skip to main content

0️⃣ Zero-to-One/Many Relationships, Colors and more!

Valentine’s Day taught us relationships can be rock-solid or a little… optional πŸ’”β€”and your database is no different! Our latest update lets you define optional or mandatory relationships, customize their colors, and add names to make your diagrams clearer and more meaningful.

Optional or Mandatory Relationships (free plan)​

Using the nullable constraint on the foreign key, we can now automatically determine whether a relationship is optional (zero-to-one/many) or mandatory (one-to-one/many) for the parent entity. Take a look at our example below:

Table follows {
following_user_id int [ref: > users.id] // optional, many-to-zero relationship
followed_user_id int [ref: > users.id, null] // optional, many-to-zero relationship
}

Table posts {
id int [pk]
user_id int [ref: > users.id, not null] // mandatory, many-to-one relationship
}

Zero-to-one/many relationship

Custom Color for Relationship Lines (paid plan only)​

Make your diagrams more readable by assigning custom colors to relationships. You can either pick up a color directly in the diagram or define it via DBML with this syntax:

Ref: posts.user_id > users.id [color: #aabbcc]

If not defined, the relationship line will inherit the parent table’s header color by default.

We’ve also added a flowing animation to show the direction of each relationship.

Custom color for relationship

Named Relationships (free plan)​

Label your relationships in DBML and see the names pop up on hover in your diagram! These hover-triggered names make it a breeze to identify connections without cluttering the view.

The syntax for naming a relationship is as follows:

Ref user_posts: posts.user_id > users.id

Named relationship

We hope these enhancements improve your database design and communication experience. Try them out and let us know what you think.


🎨 Support Notes & Color for Table Groups

You can now set customized colors and add notes to table groups.

Table Group Notes and Color

Table Group Color​

No more boring, grayed-out table groups that are difficult to spot when zoomed out, as you can now make them more colorful and distinct.

You can directly pick a color for your table group in the UI or use the following coding syntax:

TableGroup "Order Management" [color: #E74C3C] {
...
}

Select color for table group

Table Group Notes​

Add Markdown descriptions for table groups to provide extra information, such as their purposes, specific details about child tables, and so on.

To add notes, use the following syntax:

TableGroup "User Wishlist System" [note: 'Manages the user wishlist functionality'] {
...

// or use multi-line string to define Markdown content
Note: '''
This group manages the user wishlist functionality.
- wishlists: Stores user-specific wishlists.
- wishlist_items: Contains items added to each wishlist.
'''
}

Add notes to table group

Both features are available as part of our paid Table Group feature set.

We believe this enhancement will greatly improve your database designing experience, and we look forward to yourΒ feedback.


βš™οΈ Generate DBML from Direct DB Connection

Our new db2dbml CLI command now allows you to generate DBML code directly from your database. This feature simplifies the database visualization process so that you can focus solely on designing new database structures for your new features. Generate DBML from database

Make sure to use the Import > From Database Connection (via CLI) option to get a detailed guide for your database type: Generate DBML from database

Here is how we use db2dbml (included in dbdocs CLI) to generate DBML and create a database documentation project in dbdocs: Generate DBML from database

Is it safe to allow dbdocs CLI to connect to my database? Yes

  • Everything runs on your local machine, and the database credentials are not tracked or sent anywhere.
  • The database connection is secured.
  • The code is open source from the @dbml/cli & @dbml/connector packages and can be checked here.

Supported databases: PostgreSQL, MySQL, MSSQL, Snowflake, BigQuery.

Please give this feature a try andΒ let us knowΒ what you think.


πŸš€ Support Import from Snowflake

Today we are excited to share that we now support importing from Snowflake DDL!

If you are a Snowflake user, you can quickly generate a database relationship diagram (ERD) from the DDL of your database objects.

Import Database from Snowflake DDL.gif

πŸ’ŒΒ For any questions or concerns regarding this feature, our support team is here to assist you. You can reach out to us via ourΒ Contact UsΒ form.

🌍 For the latest update on new dbdiagram features, make sure to follow us on our social media: 🐦 TWITTER - 🧳 LINKEDIN

Thank you for your continued support and trust in our products.


βš™οΈ dbdiagram API 1.0 (Beta)

We are pleased to announce that the dbdiagram API 1.0 is now operational!

Creating diagrams programmatically and adding them to your documents, blogs, and websites will be the main feature of our first API release.

Manage dbdiagram API tokens

Note: API access is currently in Beta and only available if you have a paid plan.

🌍 For the latest update on new dbdiagram features, make sure to follow us on our social media: 🐦 TWITTER - 🧳 LINKEDIN

Thank you for your continued support and trust in our products.