Skip to main content

64 posts tagged with "dbdiagram"

View All Tags

🎨 Table Header Color - Personal Pro feature

Ready to make your diagrams more colorful ? πŸ€©πŸŒˆπŸ™ˆ

We're excited to announce that you can now easily decorate your diagram by changing table header color.

Table header color syntax example

Table users as U [headercolor: #d35400] {
id int
full_name varchar
created_at timestamp
country_code int
}

Table Header Color is a premium feature of dbdiagram.io.

All you need to unlock this premium feature is to TWEET about us on Twitter.

Here is the guide πŸ‘‡

  • Step 1: Tweet about us on Twitter

  • Step 2: Copy and paste your tweet link

  • Step 3: Claim the premium feature

That's it. Enjoy and make beautiful diagrams 😎



πŸŽ‰ Support auto-increment

We heard you! dbdiagram.io now supports auto-increment!

Our DBML sample code:

Table users {
id integer [pk, increment]
name varchar [not null]
}

When in PostgreSQL:

CREATE TABLE "users" (
"id" SERIAL PRIMARY KEY,
"name" varchar NOT NULL
)

When in MySQL:

CREATE TABLE `users`
(
`id` integer PRIMARY KEY AUTO_INCREMENT,
`name` varchar(255) NOT NULL
)

Also, do check out our new community forum on https://community.dbdiagram.io/!


πŸ’¬ Community Forum has moved!

Hi dbdiagram.io users, it's been a great journey with you! To have a better focus on our engagement, we are proud to announce: We have moved our forum from Holistics forum to the new site at https://community.dbdiagram.io/!

dbdiagram_forum

New categories will be created and we hope this will allow you to quickly obtain answers for all your queries πŸ˜‰


πŸ” Support Index for Tables

  1. Users can define index using DBML in the code editor
  2. Users can export DBML to SQL with the indexes defined as SQL

There are 3 types of index definitions:​

Example 1 with PostgreSQL​

  • Index with single field (with index name):
    CREATE INDEX Date on users (created_at)

  • Index with multiple fields (composite index):
    CREATE INDEX on users (created_at, country)

  • Index with an expression:
    CREATE INDEX ON users (lower(name))

  • (bonus) Composite index with expression:

    CREATE INDEX ON users ( country, (lower(name)) )

Indexes {
created_at [name: "Date"]
(created_at, country)
`lower(name)`
(country,`lower(name)`)
(country) [unique]
booking_date [type: btree]
}

Index Settings​

  • type: type of index (btree, gin, gist, hash depending on DB), we only accept type Btree and Hash for now.
  • name: name of index
  • unique: unique index

Example 2​

Users can define single or multi-column indexes. Example 2 shows a multi-column index.

Table products {
id int [pk]
name varchar
merchant_id int [not null]
price int
status varchar
created_at datetime [default: `now()`]

Indexes {
(merchant_id, status) [name:"product_status"]
id [unique]
}
}

In the visual plane,​

Share with us what you think of our Index syntax or any other releases at our new community forum on https://community.dbdiagram.io/!