Objects can be copied (
Ctrl+C), cut (
Ctrl+X), duplicated (
Ctrl+D), and deleted (
Del) in the database model. In the case of copy and cut operations, you can also do these actions between the loaded database models as well. One caution should be taken when you are trying to cut or delete a set of objects: in pgModeler, the objects are strongly linked and in some cases deleting or cutting certain objects may cause the removal of other ones not necessarily selected by the user. This happens mainly to relationships that generate columns that can be referenced by many other objects. If the user removes the relationship all the objects that reference the generated columns will be excluded too.
For copy and cut operations, pgModeler offers the user the option to copy the selected object's dependencies. This is useful when you are doing these actions between models and the dependencies don't exist on the destination. For instance, let's say you want to copy the table
table_a that is under
schema_a and intend to paste it into another model but the mentioned schema does not exist there. What the copy dependencies do is to insert the
schema_a in the list of objects to be copied and in the moment of pasting them in the second database model both
schema_a are created there. In the case of pasting objects on the database model where there are conflicting names, the pasted objects will be automatically renamed and will receive the suffix
_cp in order to distinguish their names.
The duplicate operation works almost like a copy and a paste in a single step. The difference is that, unlike the copy operation, it creates completely detached objects and is performed only in the current model. An example of a detached object is a table that holds columns and constraints added by a relationship. When duplicating the table all columns and constraints are duplicated in the resulting table too. This does not happen on copy operation because it only considers objects that aren't added to the table by relationships. See the image below to have an idea of the results produced by the duplication and copy operations. On the left, the object
public.table_b_cp is a result of duplication from
public.table_b, note that the resulting table has more objects compared to the same table on the right side of the image which denotes the result of a copy and a paste operation.
Finally, the delete cascade (
Shift+Del) operation drops an object and all its children and references. But be careful when using this action because if there is one or more protected objects in the set to be dropped the whole operation is aborted but the ones already deleted aren't restored and in some cases the change is irreversible.