To add layers to an EER Diagram, use the Layer
tool on the vertical toolbar. Select an EER
Diagram tab and left-click the layer icon on the
vertical toolbar. The layer icon is the rectangle with an
‘L’
in the lower left corner and it
is found below the eraser icon.
Clicking the mouse on this icon changes the mouse pointer to a layer pointer. You can also change the mouse pointer to a layer pointer by pressing the L key.
Choosing the Layer
tool changes the contents of
the toolbar that appears immediately below the menu bar. When the
Layers
pointer is active, this toolbar contains
a color chart list. Use this list to select the color accent for
the new layer. The color of your layer can be changed later using
the Properties
palette.
Create a layer by clicking anywhere on the EER Diagram canvas and,
while holding the left mouse button down, draw a rectangle of a
suitable size. This creates a new layer with the default name
layer1
. To revert to the default mouse pointer,
click the arrow icon at the top of the vertical toolbar.
The following figure shows a layer named "My Sakila Views" with several views:
To open the layer editor, either double-click the layer or right-click the layer and choose the edit option. The available context-menu options are:
A layer may also be edited via Properties Editor on the left panel, and it offers additional edit options.
The cut and copy items are useful for copying layers between different schemata.
Since layers are not schema objects, no confirmation dialog box opens when you delete a layer regardless of how you have configured MySQL Workbench. Deleting a layer does not delete schema objects from the catalog.
To add an object to a layer, drag and drop it directly from the
Catalog
palette onto a layer. If you pick up
an object from an EER diagram, you must press
Control as you drag it onto the layer,
otherwise it will not be “locked” inside the layer.
Locking objects to a layer prevents their accidental removal. You cannot remove them by clicking and dragging; to remove an object, you also must press the Control key while dragging it.
As a visual cue that the object is being “locked”, the outline of the layer is highlighted as the object is dragged over it.
If you drag a layer over a table object, the table object will automatically be added to the layer. This also works for multiple table objects.
Layers cannot be nested. That is, a layer cannot contain another layer object.