Skip to main content
← Back to index page

🚀 Support Default Value

dbdiagram.io now allows default value to your columns! For example, when creating BOOLEAN columns, we commonly give the column a default value (TRUE or FALSE, whatever is appropriate) and make the column NOT NULL. This means, if no other value is given, you can be confident that the column will have a set appropriate value.

Syntax

  • number value starts blank: default: 123 or default: 123.456
  • string value starts with single quotes: default: 'some string value'
  • expression value is wrapped with backtick: default: `now() - interval '5 days'`
  • boolean: default: false

Example 1

Table users {
id integer [primary key]
username varchar(255) [not null, unique]
full_name varchar(255) [not null]
gender varchar(1) [default: 'm']
created_at timestamp [default: `now()`]
rating integer [default: 10]
}

Example 2

Enum job_status {
created
running
done
failure
}

Table jobs {
id integer
status job_status [note: 'Status of a job', default: 'created']
}

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