Skip to content

Commit

Permalink
Merge pull request #2844 from EnterpriseDB/docs/pem/developing-copy-e…
Browse files Browse the repository at this point in the history
…dits

PEM: Developing section copy edits
  • Loading branch information
drothery-edb authored Jul 6, 2022
2 parents 7625f34 + 7bf5497 commit 4bfe19f
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 159 deletions.
119 changes: 62 additions & 57 deletions product_docs/docs/pem/8/pem_erd_tool.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,138 +6,143 @@ redirects:
- /pem/latest/pem_ent_feat/04_pem_erd_tool/
---

!!! tip "New Feature "
The ERD Tool is available in PEM 8.1.0 and later.
!!! tip "New feature "
The ERD tool is available in PEM 8.1.0 and later.

The **Entity-Relationship Diagram (ERD)** tool is a database design tool that provides a graphical representation of database tables, columns, and inter-relationships. ERD can give sufficient information for the database administrator to follow when developing and maintaining the database. You can access the ERD Tool via the `ERD Tool` menu option on the `Tools` menu. The ERD Tool allows you to:
The Entity-Relationship Diagram (ERD) tool is a database design tool that provides a graphical representation of database tables, columns, and inter-relationships. ERD can give sufficient information for the database administrator to follow when developing and maintaining the database. To access the ERD tool, select **Tools > ERD Tool**. The ERD tool allows you to:

- Design and visualize the database tables and their relationships.
- Add notes to the diagram.
- Auto-align the tables and links for cleaner visualization.
- Align the tables and links for a cleaner look.
- Save the diagram and open it later to continue working on it.
- Generate ready to run SQL from the database design.
- Generate ready-to-run SQL from the database design.
- Generate the database diagram for an existing database.

![ERD Tool](images/erd_tool.png)

You can open multiple copies of the ERD tool in individual tabs simultaneously. To close a copy of the ERD tool, click the `X` in the upper-right hand corner of the tab bar.
You can open multiple copies of the ERD tool in individual tabs simultaneously. To close a copy of the ERD tool, select the **X** in the upper-right corner of the tab bar.

## Toolbar

The **ERD Tool** toolbar uses context-sensitive icons that provide shortcuts to frequently performed tasks. The option is enabled for the highlighted icon and is disabled for the grayed-out icon.
The ERD Tool toolbar uses context-sensitive icons that provide shortcuts to frequently performed tasks. When an icon is enabled, it appears highlighted. When an icon is disabled, it appears grayed-out.

![ERD Tool - Toolbar](images/erd_tool_toolbar.png)

## File options

| Icon | Behavior | Shortcut |
| ----------- | -------------------------------------------------------------------------------------------------------------- | ---------------- |
| `Open File` | Click the `Open File` icon to load a previously saved diagram. | Ctrl + O |
| `Save` | Click the `Save` icon to perform a quick-save of a previously saved diagram, or to save the diagram to a file. | Ctrl + S |
| `Save as` | Click the `Save As` to open a new browser dialog and specify a new location to save the diagram. | Ctrl + Shift + S |
| Open File | Load a saved diagram. | Ctrl + O |
| Save | Save changes to a saved diagram or save the diagram to a file. | Ctrl + S |
| Save as | Open a new dialog box and specify a new location to save the diagram. | Ctrl + Shift + S |

## Export options

| Icon | Behavior | Shortcut |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| `Generate SQL` | Click the `Generate SQL` icon to generate the DDL SQL for the diagram and open a query tool with the generated SQL ready for execution. | Option + Ctrl + S |
| `Download image` | Click the `Download image` icon to save the ERD diagram in a image format. | Option + Ctrl + I |
| Generate SQL | Generate the DDL SQL for the diagram and open a Query tool with the generated SQL ready for execution. | Option + Ctrl + S |
| Download image | Save the ERD diagram in an image format. | Option + Ctrl + I |

## Editing options

| Icon | Behavior | Shortcut |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `Add table` | Click this button to add a new table to the diagram. On clicking, this will open a table dialog where you can put the table details. | Option/Alt + Ctrl + A |
| `Edit table` | Click this button to edit a table on the diagram. On clicking, this will open a table dialog where you can change table details. This will enable when a table is selected. | Option/Alt + Ctrl + E |
| `Clone table` | Click this button to clone the complete table structure, name it with a auto generated name and put it in the diagram. | Option/Alt + Ctrl + C |
| `Drop table/link` | You can drop a table or link using this button. You need to select a table or link and click on this button to drop it. | Option/Alt + Ctrl + D |
| Add table | Add a new table to the diagram. In the table dialog box, enter the table details. | Option/Alt + Ctrl + A |
| Edit table | Edit a selected table on the diagram. In the table dialog box, enter the table details. | Option/Alt + Ctrl + E |
| Clone table | Clone the complete table structure, name it with a auto-generated name, and put it in the diagram. | Option/Alt + Ctrl + C |
| Drop table/link | Drop a selected table or link. | Option/Alt + Ctrl + D |

## Table relationship options

| Icon | Behavior | Shortcut |
| ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `1M` | Click this button to open a one-to-many relationship dialog to add a relationship between the two tables. The selected table becomes the referencing table and will have the `many` endpoint of the link. | Option/Alt + Ctrl + O |
| `MM` | Click this button to open a many-to-many relationship dialog to add a relationship between the two tables. This option will create a new table based on the selected columns for the two relating tables and link them. | Option/Alt + Ctrl + M |
| 1M | Open a one-to-many relationship dialog box to add a relationship between two tables. The selected table is the referencing table and has the `many` endpoint of the link. | Option/Alt + Ctrl + O |
| MM | Open a many-to-many relationship dialog box to add a relationship between two tables. This option creates a linked table from the selected columns of the two relating tables. | Option/Alt + Ctrl + M |

## Utility Options

| Icon | Behavior | Shortcut |
| --------------- | ------------------------------------------------------------------------------------------------------------ | ---------------------- |
| `Add/Edit note` | Click this button to make notes on tables nodes while designing the database. | Option/Alt + Ctrl + N |
| `Auto align` | Click this button to auto align all tables and links to make it look more cleaner. | Option/Alt + Ctrl + L |
| `Show details` | Click this button to toggle the column details visibility. It allows you to show few or more column details. | Option/Alt + Shift + D |
| Add/Edit note | Make notes on table nodes while designing the database. | Option/Alt + Ctrl + N |
| Auto align | Align all tables and links for a cleaner look. | Option/Alt + Ctrl + L |
| Show details | Toggle the column details. You can also choose to show few or more column details. | Option/Alt + Shift + D |

## Zoom options

| Icon | Behavior | Shortcut |
| ------------- | ---------------------------------------------------------------------------------- | ------------------------ |
| `Zoom to fit` | Click this button to zoom in/out automatically and fit all the tables to the view. | Option/Alt + Shift + F |
| `Zoom in` | Click this button to zoom in the diagram. | Option/Alt + Shift + "+" |
| `Zoom out` | Click this button to zoom out the diagram. | Option/Alt + Shift + "-" |
| Zoom to fit | Zoom in/out automatically and fit all the tables to the view. | Option/Alt + Shift + F |
| Zoom in | Zoom in on the diagram. | Option/Alt + Shift + "+" |
| Zoom out | Zoom out on the diagram. | Option/Alt + Shift + "-" |

## Table dialog

![ERD Tool - Table Dialog](images/erd_table_dialog.png)

The table dialog allows you to:
The table dialog box allows you to:

- Change the table structure details.
- It can be used edit an existing table or add a new one.
- Refer [Table dialog](pem_online_help/05_toc_pem_management_basics/12_modifying_tables/10_table_dialog) for information on different fields.
- Edit an existing table or add a new one.
- See [Table dialog](pem_online_help/05_toc_pem_management_basics/12_modifying_tables/10_table_dialog) for information on different fields.

## Table node

![ERD Tool - Table Node](images/erd_table_node.png)

The table node shows table details in a graphical representation:

- The top bar has a `details toggle button` that is used to toggle column details visibility. There is also a `note button` that is visible only if there is some note added. you can click on this button to quickly change the note.
- The first row shows the schema name of the table. Eg. `public` in above image.
- The second row shows the table name. Eg. `users` in above image.
- All other rows below the table name are the columns of the table along with data type. If the column is a primary key then it will have lock key icon eg. id is the primary key in above image. Otherwise, it will have column icon.
- You can click on the node and drag to move on the canvas.
- Upon double click on the table node or by clicking the edit button from the toolbar, the table dialog opens where you can change the table details. Refer [Table dialog](pem_online_help/05_toc_pem_management_basics/12_modifying_tables/10_table_dialog) for information on different fields.
- On the top bar:
- To show column details, select **Details toggle**.
- When you add a note, **Note** becomes enabled. Select **Note** to changes notes.
- The first row displays the table's schema name, like `public` in the example.
- The second row displays the table's name, like `users` in the example.
- The remaining rows dispalys the table's column names and their data types.
- A column that is a primary key displays as a lock key, like `id integer` in the example.
- Other columns diplay as a green column, like `email character varying` in the example.
- Select the node to drag it on the canvas.
- To open the table dialog box and change the table details, either double-click the table node or select **Edit** on the toolbar. See [Table dialog](pem_online_help/05_toc_pem_management_basics/12_modifying_tables/10_table_dialog) for information on different fields.

## One to many link dialog
## One-to-many link dialog box

![ERD Tool - One to Many Dialog](images/erd_1m_dialog.png)
![ERD Tool - One-to-Many Dialog Box](images/erd_1m_dialog.png)

The one to many link dialog allows you to:
The one-to-many link dialog box allows you to:

- Add a foregin key relationship between two tables.
- `Local Table` is the table that references a table and has the `many` end point.
- `Local Column` is the column that references.
- `Referenced Table` is the table that is being referred and has the `one` end point.
- `Referenced Column` is the column that is being referred.
- Select a Local Table that references another table. The Local Table has the `many` end point.
- Select a Local Column that references another column.
- Select the Referenced Table. The Referenced Table has the `one` end point.
- Select the Referenced Column.

## Many to many link dialog
## Many-to-many link dialog box

![ERD Tool - Many to Many Dialog](images/erd_mm_dialog.png)
![ERD Tool - Many-to-Many Dialog box](images/erd_mm_dialog.png)

The many to many link dialog allows you to:
The many-to-many link dialog box allows you to:

- Add a many to many relationship between two tables.
- It creates a relationship tables having columns derived from the two tables and link them to the tables.
- `Left Table` is the first table that is to be linked. It will receive the `one` endpoint of the link with the new relation table.
- `Left Column` is the column of the first table, that will always be a primary key.
- `Right Table` is the second table that is to be linked. It will receive the `one` endpoint of the link with the new relation table.
- `Right Column` is the column of the second table, that will always be a primary key.
- Add a many-to-many relationship between two tables.
- Create a relation table with linked columns that are derived from the two tables.
- Select the Left Table, which is the first table that is linked. The Left Table has the `one` endpoint of the link with the new relation table.
- Select the Left table Column, which is the first table's column. The Left table Column is a primary key.
- Select the Right Table, which is the second table that is linked. The Right Table has the `one` endpoint of the link with the new relation table.
- Select the Right table Column, which is the second table's column. The Right table Column is a primary key.

## Table link

![ERD Tool - Table Link](images/erd_table_link.png)

The table link shows relationship between tables:
The table link shows the relationship between tables:

- The single line endpoint of the link shows the column that is being referred.
- The three line endpoint of the link shows the column that refers.
- If one of the columns that is being referred or that refers is removed from the table then the link will get dropped.
- You can click on the link and drag to move on the canvas.
- The single-line endpoint of the link shows the column that is the reference.
- The three-line endpoint of the link shows the column that references.
- If one of the columns that is a reference or that references is removed from the table, then the link drops.
- Select the link to drag it on the canvas.

## Table notes

![ERD Tool - Table Notes](images/erd_table_note.png)

- You can use the notes popup to mark some notes while designing the database.
- You open the pop-up using the toolbar note button.
- If some note is added to a table then it will have notes button on the table node. You can click on the button to check/update notes.
- To add a note to a table:
1. On the toolbar, select **Add/Edit note**.
1. In the window, enter your note.
- When a note is added to a table, **Note** becomes enabled on the Table node. To check or update notes, select **Note**.
Loading

0 comments on commit 4bfe19f

Please sign in to comment.