Editors and views
pgCodeKeeper project editor
Project editor is the main way of working with pgCodeKeeper. The editor interface consists of several main parts:
Eclipse tool bar
Editor tool bar
Differences table
Comparison tool bar
Comparison panel
Object counter
Eclipse tool bar contains tools for working with SQL editor. The
button allows you to open a new SQL editor.
Editor tool bar is used for working with the object list. It has the following features:
– select all objects.
– deselect all the objects.
– invert the selecting of objects.
– copy the set of selected objects to the clipboard as a regular expression.
– inactive /
– active object filter.
– apply changes
– drop-down menu with the directions of changes. If you click the DB label, you will also see the menu with the directions of changes.
– drop-down menu with the databases sources. You can select the database sources from the right-click menu of the selected DB
on the editor tool bar (2).
The
drop-down menus allow us to launch the operations of receiving and applying changes with overriding some settings.
Overridable settings for getting changes
Overridable settings for applying changes
Diff table shows the list of objects different for the DB schemas under comparison. Here you can find the info on object type, change type, object name, container, git user, database user.
Object type - the following object types are available:
PostgreSQL - AGGREGATE, CAST, CONSTRAINT, DOMAIN, EVENT EXTENSION, FTS_CONFIGURATION, FTS_DICTIONARY, FTS_PARSER, FTS_TEMPLATE, FUNCTION, INDEX, OPERATOR, POLICY, PROCEDURE, RULE, SCHEMA, SEQUENCE, STATICTICS, TABLE, TRIGER, TRIGGER, TYPE, VIEW.
MS SQL - ASSEMBLY, CONSTRAINT, FUNCTION, INDEX, PROCEDURE, ROLE, SCHEMA, SEQUENCE, TABLE, TRIGGER, TYPE, USER, VIEW.
ClickHouse - CONSTRAINT, DICTIONARY, FUNCTION, INDEX, ROLE, SCHEMA(DATABASE), TABLE, USER, VIEW.
Change type - an object can be in one of three conditions: exist only in a database, only in a project, or in both a project and a database. Depending on the condition and the direction of changes, objects in the list are marked as ‘delete’, ‘add’ and ‘edit’ or ‘CREATE’, ‘DROP’ and ‘ALTER’ respectively.
Container is the name of the parent object. For example, for an index, it is the name of a table or a view this index belongs to.
Git user - name of the user, who was the last one to change the project file for this object. In case if the files were changed locally, you’ll see a ‘*’ next to the username. To see this column, you should connect the project to the version control system and enable the corresponding option on the Project editor settings page.
Database user - name of the database user who was the last one to change the object in the database. To display this column, you’ll need the pg_dbo_timestamp extension.
Comparison tool bar is used for working with comparison panel. It has the following features:
- swap the code of the objects on the comparison panel.
- display the code of all child objects on the comparison panel, even if they are identical.
Comparison panel shows changes which took place in SQL view of an object.
Object counter shows the selected and the total number of objects in the table.
Object search in the differences table
The most convenient way of searching for the objects in the differences table is the search box above the changes list.
The search is conducted by the names of the objects. When RegEx is ticked off, the search is conducted with the use of regular expressions.
To start with, just enter a part of the name into the search box. The objects satisfying this condition will be displayed in the differences table.
The search box stores the last 200 entries.
To search by the qualified object name, enter the name of the schema with . in the search field.
As a result, all the objects of this schema, excluding the schema itself, will be displayed in the differences table.
Enter its name to display the schema only.
Object filters
To filter the objects, you can use the dialog window which will appear after you click
above the changes list.
The object type list allows to display only the selected types of objects. Selecting the TABLE or VIEW types will display all the descendant objects.
The changes type list allows to display only the selected types of changes.
Filter by object’s SQL code searches for matches in the object generation code.
Search by container searches for objects located in the <container> containers with appropriate names. Container objects will be displayed as well.
Search by database user searches for matches in the authors of object changes in the thirdparty database. The pg_dbo_timestamp extension is necessary for work.
Search by git user searches for matches in the authors of the latest object change in local repository. This can be used if the project is under the version control system.
Show only local changes displays the changes that took place in local repository after the last commit. This can be used if the project is under the version control system.
Hide library objects hides the objects downloaded from libraries.
To apply the filters, click ОK.
To cancel current changes, click Cancel.
To reset all the filters, click Reset.
When the filter is on, the button icon will change to
.
SQL editor
SQL editor is not different from a regular Eclipse text editor appearance-wise, but it has functions of SQL syntax highlighting, SQL requests template autofilling, database schema objects navigation, and code formatting.
When using SQL-editor on the Eclipse tool bar, you will have the following options:
- Quick update. Execution of the migration script for differences between the object in the current file of the project and the respective object in the database. If the changes concern objects from other files or modify the data (for example, delete a column), there will be no update.
- Execute selection. Execution of the current migration script (or the highlighted text) in the selected database.
- Cancel execution. Cancel of execution of the current migration script.To format the highlighted piece of code, press Shift + Ctrl + F or select Format in the right-click menu.
Viewing the dependences of DB objects
Dependency graph panel
The Dependency graph panel shows the dependencies containing the current object selected on the differences panel of the active project editor.
The arrows show the direction of connection of the dependant object towards its dependence.
The Project - Remote switch allows you to select the database under comparison for which you want to display objects and dependencies. After switching, you should select the element on the editor diff panel once again.
The
Show columns button allows displaying the columns of the tables of the current objects as well as its dependencies.
Add depcy allows you to open the dialog of manual adding of the dependencies.
In this window, you can directly set the dependences between the DB objects. This may prove useful, for example, in case if automated recognition won’t work for certain complex dependences. The added differences will be taken into consideration during generating the expression sequences for the migration script.
The window consists of two parts which serve for adding the dependences to the DB under comparison.
To add dependencies between objects, simply start entering the first letters of the object name, select the names of the dependent objects in the drop-down list and click Add. You’ll see the dependency in the list of added.
To remove a chain of dependent objects, highlight it and click Remove.
Object’s dependency tree
You can also view an object’s dependencies as text.
To do that, click Build a dependency graph in the right-click menu of the required object in the differences table
The following settings are available in the dialog box that opens:
Schema source: - data source for searching for dependencies.
Show: - direction of search: it’s either dependent objects (Calls) or objects on which the object depends (Dependencies).
Graph search depth - depth of search for dependencies. By default, this value is 10.
Object Type - types of displayed objects. By default, all types of objects are displayed.
Object overrides
The Object overrides view displays the list of overridden objects in libraries for the active project editor. This view is displayed automatically when receiving changes if there is at least one conflict present.
The
button shows the notes concerning only the objects selected on the differences panel of the active project editor.
Right-click menu allows you to open both versions of the object, as well as to view the differences in a dedicated comparison editor.
Query result
Query result view displays query results. Each query is displayed in a separate tab.
Attention
Large samples may cause the graphical interface to “freeze”.

