PhpStorm 2021.2 Help

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. PhpStorm tracks changes only for objects that store their source code in the database. For example, triggers, procedures, functions, views, and other objects.

The Database Changes Tool Window

See the diff between modified and stored versions

  • In the Database Changes tool window, double-click a database object.

    See the diff between modified and stored versions
  • When you edit source code of any object, PhpStorm 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 (the Show diff icon) to see the difference between the code that you added and the one from source code.

    IDE highlights changes in source code

Load source code for a data source

  1. In the Database tool window (View | Tool Windows | Database), click the Data Source Properties icon The Data Source Properties icon.

  2. Select one or more data sources for which you want to download source code.

  3. Right-click the selection and navigate to Load Sources. 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.

    Load source code for a data source

Outdated cached objects

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

Outdated chached objects

If you see this warning in the IDE, you can select between the following actions:

  • Synchronize: PhpStorm 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).

Outdated cached objects

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

Outdated cached objects

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.

    Outdated cached objects

Controls of the Database Changes tool window

Item

Shortcut

Description

the Submit button

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.

Compare with Show Diff

Ctrl+D

Compare two versions of source code.

Group by Group by

Ctrl+D

Group objects according to their type. For example, routines, rules, or views.

the Expand All button

Ctrl+NumPad +

Expand all nodes in all trees.

the Collapse All button

Ctrl+NumPad -

Collapse all nodes in all trees.

Last modified: 15 December 2021