Editors and views

pgCodeKeeper project editor

Project editor is the main way of working with pgCodeKeeper. The editor interface consists of several main parts:

  1. Eclipse tool bar

  2. Editor tool bar

  3. Differences table

  4. Comparison panel

  5. Object counter

_images/main_view.png

Eclipse tool bar contains tools for working with SQL editor. The file button allows you to open a new SQL editor.

Editor tool bar is used for working with the object list. There are the following opportunities:

  • check_all – select all objects.

  • uncheck_all – deselect all the objects.

  • loop_obj – invert the selecting of objects.

  • copy_edit – copy the set of selected objects to the clipboard as a regular expression.

  • empty_filter – inactive / filter_tsk – active object filter.

  • search – filter list of objects by name or regular expression.

  • save_edit – apply changes

  • triangle – 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.

  • refresh – get changes

  • triangle – drop-down menu with the databases sources. You can select the database sources from the right-click menu of the selected DB source_name on the editor tool bar (2).

The triangle drop-down menus allow us to launch the operations of receiving and applying changes with overriding some settings.

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 supported: SCHEMA, TYPE, SEQUENCE, TABLE, FUNCTION, PROCEDURE, VIEW, CONSTRAINT, INDEX, TRIGGER.

CAST, EXTENSION, DOMAIN, OPERATOR, FTS_PARSER, FTS_TEMPLATE, FTS_DICTIONARY, FTS_CONFIGURATION, AGGREGATE, RULE, POLICY, EVENT TRIGER are supported additionally for PostgreSQL.

USER, ROLE, ASSEMBLY are supported additionally for MS SQL.

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 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.

_images/search1.png

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.

_images/search_qualified_name.png

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 empty_filter above the changes list.

_images/filters.png

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 the objects located in the schemas with appropriate names. Schema 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 filter_tsk.

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.

_images/autocomplete.png

When using SQL-editor on the Eclipse tool bar, you will have the following options:

quick_update - 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.
update_ddl - Execute selection. Execution of the current migration script (or the highlighted text) in the selected database.
progress_stop - Cancel execution. Cancel of execution of the current migration script.
refresh - Get changes. Refreshes the editor of the project containing the current file. Applicable to project files only.

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

The pg Dependencies view shows the dependencies containing the current object selected on the diff panel of the active project editor.

_images/pg_depend.png

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_col Show columns button allows displaying the columns of the tables of the current objects as well as its dependencies.

add_dep Add depcy allows you to open the dialog of manual adding of the dependencies.

_images/manual_depcies.png

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 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.

_images/override_view.png

The sync 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”.

_images/result_set_view.png