DbSchema Layouts

Index

What is a Layout?

A layout is a database diagram with associated data and query tools. Think of it like a board on which you can make your own representation of the database schema. Inside the layout, you can edit tables and foreign keys by just double-clicking on them. Add tables, foreign keys, groups, callouts, and access data tools like Relational Data Explorer or SQL Editor. You can create as many layouts as you need, each focused on a specific part of the schema. A table can be present in multiple layouts.

Database Diagrams Layout Tabs

Why we use Layouts?

Symbols in Layouts

Inside a layout, everything is represented graphically. This will help you gain a better understanding of the database and browse the data easily.

1. Table

Edit database table in diagram

2. Foreign Keys

Foreign keys can also have different visual representations based on their cardinality and ordinality. These are consequences of the nature of columns and indexes.

Based on the referencing column, there are 4 states in which a foreign key can be. We will try to understand them better by looking at some examples:

  1. One to zero or many

    In the child table, the referencing column is not mandatory, nor unique. In this case, the parent table (1) can refer to zero or many entries in the child table (2).

    One to zero or many foreign key
  2. One to one or many

    In the child table, the referencing column is mandatory, but not unique. In this case, the column from the parent table can refer to one (mandatory) or many.

    One to one or many foreign key
  3. One to one

    In the child table, the referencing column is mandatory and unique. In this case, the column from the parent table can refer only to one entry from the child table.

    One to zero or one foreign key
  4. One to zero or one

    In the child table, the referencing column is unique, but not mandatory. In this case, the column from the parent table can refer to one or zero entries from the child table.

    One to zero or one foreign key

Design Schema Online or Offline

Using DbSchema you can design the schema while connected to a database (online) or without database connection (offline).

In the online mode, all table and column changes will be applied in the database. The executed statements are visible on the left, in the SQL History pane.

In the offline mode, changes will be applied only to the DbSchema model which will be saved to file. You need to connect to the database and choose one of the Schema options (Refresh/Compare with the database).

Design database schema offline

Add tables to layout

1. Add tables from the tree panel by drag & drop.

Drag & Drop tables to layout

2. Add tables using the foreign key icon.

Open tables to layout using the foreign key icon

Auto place

If you open a new schema model that was not initially designed in DbSchema, the diagram can appear messy and unorganized.
DbSchema integrates an option that will instantly organize the schema for you.
To access it, right-click on the layout and choose the Auto place option.
Autoplace tables in the diagram

Column Visibility & Position

DbSchema does not allow resizing tables. Instead, you can choose the visible columns. The reason for this is that we focus on large and very large diagrams, where this feature will conflict with our algorithms for optimal handling diagrams.
  1. Change the column visibility by double-clicking the table header. Then choose whether you want to see it or not from the visible column.
  2. Change the column position by clicking on the Up or Down buttons.
Set visible columns in the diagram

Virtual Foreign Keys

There are databases that contains no foreign keys. In these situations, you may create virtual foreign keys. Virtual foreign keys will be created only in DbSchema and will be saved to the model file.

Create virtual foreign keys

Foreign Key Routing

The foreign key line is routed automatically.
DbSchema is optimized for managing large diagrams, where this feature is likely to create problems.

You can choose between two modes of routing the foreign key lines: from table to table or from column to column.
In the second case, the line will point to the involved columns. Two foreign keys may merge into one line if they are pointing to the same column.

Set diagram routing method Diagram foreign key Routing

Show Data Type

Choose this option in the menu to show the column data type directly in the diagram. This setting is per layout.
Show column Data Type in the diagram

Add Callouts

Add callouts by right-clicking on an empty part of the layout. Choose the Create a Callout option.

Create diagram callouts

Fast Browse Table Data

Browse data from tables directly in the layout. Hold SHIFT + CTRL and click on the table header to see its contents.

Database Relational Data Explorer

Data Tools

You can open the data tool menu just by clicking on the table header.
Database Data Tools