In Luna Modeler you can use the copy and paste function to copy tables as well as individual table columns. Previously it was only possible to copy entire tables, now you can conveniently copy one or more selected table columns.
Selections and copy & paste
Working with tables and individual columns is easy. Just use the mouse and the CTRL (Command) key to expand the selection to multiple tables or multiple columns. Then use the well-known keyboard shortcuts CTRL+C and CTRL+V (command+C and command+V if you are a macOS user).
Standard copy & paste
In the diagram you can select a table, then right-click it and select Copy from the context menu.
To insert a copy of the selected table into the project, right-click on the main diagram or sub-diagram area and select Paste.
Dependencies and related objects
Inserting a copy of the table appears to be a very simple matter. However, if there is a column in the table that has a data type such as domain or enum (in a PostgreSQL database) or user-defined type (SQL Server database), you will probably want to preserve that data type.
You might think, for example:
- How to deal with such dependent objects if the target is a different or completely new project?
- Should the domain, enum or user-defined type also be copied and pasted into the target project?
- What if there is a line that leads to the original object? Should it be added?
You don’t have to ask questions like that,
you don’t have to look for answers.
We offer you the solution.
Let’s take a look at how inserting a copy of a table into the same project works and how inserting a copy into a new project behaves.
Pasting into the same project
If you insert a table into the same project, columns that use domain, enum or user-defined type will use these existing elements of your existing model. Additionally, the line leading to the original table will also be added to the newly inserted table, as seen in the screenshot below.
Pasting into a new project
If you insert the Film table into a new project, Luna Modeler recognizes that the domain, enum or user-defined type does not exist and therefore automatically adds these objects to the project. It also adds lines leading to the film table. You can see the result below:
- Newly added table film – without modified name, because the film table does not exist in the new project.
- Newly added domain year (1)
- Newly added enum rating (2)
- Newly added lines from domain and enum leading to the film table (3)
It is worth mentioning that the year (domain) and rating (enum) objects were not originally in the selection. We copied only the table film.
As you can see, Luna Modeler recognizes dependent objects and can map them when used in an existing model, or create them when using a new model as a target.
Working with table columns and dependencies
A similar miracle happens if you copy one or more columns. If this column uses a domain, enum or user-data type and you paste it into an existing project, it will be correctly mapped to the existing object.
Pasting the column to a table in the same project
Column selection and copy operation:
Pasting the column to a table in a new project
If you paste it into a table in a new project, the dependent object, i.e. domain, enum or user-data type, will be added to the project.
Working with multiple items
Now let’s see how to insert a copy or move multiple items.
In this part of the demonstration we will look at how to insert the last_update and last_update_by columns to other tables.
Select multiple columns from the table using the mouse and the CTRL (Command) key. Right click on one of them and select Copy.
Then select the target table and choose Paste from the context menu.
Deleting multiple columns at once
If you want to move columns from one table to another, use copy and paste and then you can delete the original columns. With the ability to select multiple columns in a table, this is now possible.
Automatic database objects conversion
Since version 7 you can also copy items from one project type and paste them into a project for a completely different platform. In the application settings you can configure mappings for the data type conversion.