DbSchema Layouts


Index


What is a Layout?

A layout is a tab in which you can open diagrams and editor tools. Inside the layout, you can edit tables and foreign keys by just double-clicking on them. Think of it like an board on which you can make your own representation of the database. Add tables, draw relationships between them and access data tools like Relational Data Browse or SQL Editor. You can make how many representations of the database as you need, each focused on a specific part of the schema. Because of this, a table can be present in multiple layouts.

Layout Tabs

Why use Layouts?


Symbols in Layouts

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

1. Table

Layout Table

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 children 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 children table (2).

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

    In the children 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
  3. One to one

    In the children 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 children table.

    One to zero or one
  4. One to zero or one

    In the children 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 children table.

    One to zero or one

Design Schema Online or Offline

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

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

In offline mode changes will be applied only to the DbSchema local project (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).

Online Offline

Add tables to layout

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

Drag & Drop

2. Add tables via foreign key icon.

Open FK

Autoplace

If you open a new scheme project 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 Autoplace option.
Autoplace

Column Visibility & Position

DbSchema does not allow resizing tables. Instead you can choose the visible columns. 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. Select 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.
Visibility

Virtual Foreign Keys

There are cases when the database contains no foreign keys. In this case you may want to create virtual foreign keys. Virtual foreign keys will be created only in DbSchema and will be saved to project file.

Virtual FK

Foreign Key Routing

In DbSchema, the foreign key position can't be changed. DbSchema automatically positions the foreign key lines.
We use this strategy because DbSchema is focused on managing large diagrams, where this feature is likely to create problems.

You can choose between to 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 fks may merge the same line if two fks are pointing to the same columns.

Routing Option FK Routing

Show Data Type

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

Add Callouts

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

Callout

Fast Browse Table Data

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

Data Browse

Data Tools

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