DataGrip 2018.3 Help

Refactoring Source Code

Refactoring is a process of improving your source code without creating a new functionality. Refactoring helps you keep your code solid and easy to maintain.

Rename refactoring

Rename database objects

  1. Place the caret on the object the you want to rename.

  2. Navigate to Refactor | Rename (Shift+F6). If you edit an argument in the function, you can start typing a new name inline, or press Shift+F6 twice to invoke the Rename dialog.

  3. In the Rename dialog, type a new name for the object.

  4. Review changes and click Refactor. To search for usages of the object name, click Preview.

Rename database objects

Extract refactorings

Extract a variable

  1. Place the caret on a variable in the function.

  2. Navigate to Refactor | Extract | Variable (Ctrl+Alt+V).

  3. Select a part of the expression that you want to extract and press Enter.

Extract as a Common Table Expression (CTE)

CTE is a temporary result set that you can use within another SELECT, INSERT, UPDATE, or DELETE statements. In DataGrip you can extract a subquery and convert it to CTE.

  1. Place the caret inside the subquery that you want to convert.

  2. Navigate to Refactor | Extract | Subquery as CTE.

Last modified: 28 November 2018