Review changes in source code
Everything that you write in the editor is saved as the local version of the object source code. You can examine all changes that are not committed in the Database Changes tool window.
The Database Changes tool window displays changes in source code of objects. CLion tracks changes only for objects that store their source code in the database. For example, triggers, procedures, functions, views, and other objects.
See the diff between modified and stored versions
In the Database Changes tool window, double-click a database object.
When you edit source code of any object, CLion tracks changes and highlights them in the gutter. For example, add a comment line to a routine or a trigger function. The added line becomes highlighted. If you click the highlighted line in the gutter, a small toolbar is displayed with the Show Diff button. You can click the Show Diff button () to see the difference between the code that you added and the one from source code.
Load source code for a data source
In the Database tool window ( ), click the Data Source Properties icon .
Select one or more data sources for which you want to download source code.
Right-click the selection and navigate to
. You can select between the following options:None: do not download source code.
Except System Schemas: download source code for all the objects except for system schemas.
All Schemas: download all the available source code.
Outdated cached objects
CLion caches the source code of all the objects from the database to provide fast code assistance and navigation. If an object that you opened was updated from a third-party location, you will see a notification that the cached object differs from the source code of the same object in the database.
If you see this warning in the IDE, you can select between the following actions:
Synchronize: CLion fetches changes from the database and updates the cached local object.
Disable check: disable this notification.
Also, there might be a conflict between your version of the object source code and the one in the database. For example, when you has modified the same source code as someone else and pressed Submit(Ctrl+K).
You can forcefully replace source code of the object in the database (Force Refactoring) or synchronize the object state and then proceed with changes (Abort Refactoring and Synchronize).
If you selected Abort Refactoring and Synchronize, CLion aborts the submit operation and fetches changes from the database (just like if you pressed Synchronize Ctrl+F5). If the conflict still exists, you will see the following notification.
In this notification, you can select between the following options:
Revert local changes: roll back all your changes and replace them with the version from the database.
Keep local changes: use your changes and overwrite changes in the database.
Merge: display the diff dialog to merge two versions of the object source code.
Controls of the Database Changes tool window
Item | Shortcut | Description |
---|---|---|
Submit | Ctrl+Enter | Submit local changes to the database server. See Submit changes to a database. |
Rollback | Roll back changes. This button is available only for the manual transaction mode. | |
Show Diff | Ctrl+D | Compare two versions of source code. |
Group by | Ctrl+D | Group objects according to their type. For example, routines, rules, or views. |
Ctrl+NumPad + | Expand all nodes in all trees. | |
Ctrl+NumPad - | Collapse all nodes in all trees. |