JetBrains Rider 2024.3 Help

Schema comparison and migration

Enable the Database Tools and SQL plugin

This functionality relies on the Database Tools and SQL plugin, which is bundled and enabled in JetBrains Rider by default. If the relevant features are not available, make sure that you did not disable the plugin.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Installed tab, find the Database Tools and SQL plugin, and select the checkbox next to the plugin name.

In JetBrains Rider, you can compare two database objects of the same type. For example, you can compare two schemas, two tables, or two routines. Databases with objects can be hosted on different servers. JetBrains Rider shows you the differences in the structures of these two objects in the Migration dialog.

Migration is a process of transferring structure and changes from one object to another (for example, from one schema to another). In JetBrains Rider, these objects are called Origin and Target. The migration script is generated to make Target equal to Origin. But you can modify the script to satisfy your requirements.

Compare the structure in Migration dialog

For changes, JetBrains Rider uses the following color coding.

Color

Description

Items are new

Objects added in Origin, which will be created in Target in case of a successful migration.

Items are different

Modified objects, which will be altered in Target.

Items to be deleted

Objects deleted in Origin, which will be dropped in Target in case of a successful migration.

See the description of the dialog controls in the reference section.

Schema comparison

Show differences between objects

  1. In the Database tool window (View | Tool Windows | Database) , select two objects of the same type. For example, two schemas.

  2. Right-click the selection and navigate to Tools | Compare Structure. Alternatively, press Ctrl+D.

    Differences between objects in the Migration dialog

Show differences between changes in a table form

  1. In the Migration dialog, click an item in Origin or Target fields.

  2. Click the Object Properties Diff tab.

Show differences between changes in DDL

  1. In the Migration dialog, click an item in Origin or Target fields.

  2. Click the DDL Diff tab.

    Differences between object properties

Show identical items

  • To display all items that are identical in Origin and Target objects, select the Show identical checkbox.

    The Show identical records option is enabled
    The Show identical records is disabled

Schema migration

Migrate changes between objects

  1. In the Database tool window (View | Tool Windows | Database) , select two objects of the same type. For example, two schemas.

  2. Right-click the selection and navigate to Tools | Compare Structure. Alternatively, press Ctrl+D.

    A set of statements that you can use for writing migration scripts is generated in the Script Preview tab.

  3. In the Script Preview tab, verify that the migration scripts are correct.

  4. Click Execute. Alternatively, click Open Query in Console to open all the scripts in a query console.

Select changes to migrate

  • To exclude a change, click the checkbox neat the change.

  • To exclude all the changes, click the checkbox near the Target label.

  • To include all the changes that were excluded, click the checkbox near the Target label.

Controls of the Migration dialog

Icon

Tooltip and shortcut

Description

Expand All

Expand All

Expands all the collapsed nodes.

Collapse All

Collapse All

Collapses all the expanded nodes.

Swap

Swap

Swap the Origin and Target panels.

Options

Options

Select options according to which changes are differentiated. If the option is selected, properties that are mentioned in the option are ignored in the diff.

  • Ignore Order: ignore the order in which items are going in the object.

  • Ignore Case: ignore casing in names of items.

  • Ignore Implicit Objects: ignore objects that are generated automatically. For example, indexes for foreign keys, DEFAULT CONSTRAINT for a column default in Microsoft SQL Server.

  • Ignore Source Code :ignore the body in functions or procedures. Objects are matched according to their kind and identity (for example, a function signature). Two functions are considered equal if their kind and identity are equal. Then the Diff Viewer takes into account this option – whether to ignore the function body or not.

  • Ignore Owner: ignore user privileges that are set for an item.

Selected

Include change

Apply the selected change.

Show identical

Show all items that are identical.

Controls of DDL Diff

Item

Tooltip and Shortcut

Description

the Previous Difference button/the Next Difference button

Previous Difference/Next Difference

Shift+F7/F7

Jump to the next or previous difference.

the Jump to Source button

Jump to Source

F4

Open a definition of the selected object in the active pane in the editor. The caret is placed in the same position as in the Diff Viewer.

Side-by-side viewer

Select a viewer mode: Side-by-side viewer or Unified viewer. The side-by-side mode has two panels, and the unified mode has one panel.

Whitespaces

Define how the Diff Viewer should treat whitespaces.

  • Do not ignore: white spaces are important, and all the differences are highlighted. This option is selected by default.

  • Trim whitespaces: trim whitespaces if they appear in the end and at the beginning of a line (("\t", " ")).

    • If two lines differ in trailing whitespaces only, these lines are considered equal.

    • If two lines are different, trailing whitespaces are not highlighted in the By word mode.

  • Ignore whitespaces: white spaces are not important, regardless of their location in the source code.

  • Ignore whitespaces and empty lines: ignores whitespaces and empty lines. The following entities are ignored:

    • all whitespaces (as in the Ignore whitespaces option)

    • all added or removed lines that consist of whitespaces only

    • all the changes that split or join lines without changes to non-whitespace parts.

      For example, differences between a b c and a \n b c are not highlighted in this mode.

Highlighting mode

Select the way differences are highlighted.

The available options are:

  • Highlight words: modified words are highlighted

  • Highlight lines: modified lines are highlighted

  • Highlight split changes: if this option is selected, large changes are split into smaller changes.

    For example, A \n B and A X \n B X are treated as two changes instead of one.

  • Highlight Symbols: modified symbols are highlighted

  • Do not highlight: if this option is selected, the differences are not highlighted at all.

    Use the Do not highlight option when you work with objects that were significantly modified. In such cases, highlighting might introduce additional difficulties during a review.

Synchronize Scrolling

Synchronize Scrolling

Synchronize scrolling in the left and right panes.

the Settings button

Settings

Select options that you want to ignore during the comparison.

  • Show Whitespaces: displays whitespaces as the dots in the Diff Viewer.

  • Show Line Numbers: displays line numbers in the Diff Viewer.

  • Show Indent Guides: displays vertical lines in the Diff Viewer to indicate positions of indents.

  • Soft-Wrap: wraps the lines of code, when the dialog is resized.

  • Highlighting Level: allows you to select the highlighting level in the Diff Viewer.

  • Annotate: annotates the changes.

the Help icon

Help

F1

Open a browser and show the corresponding help page.

Last modified: 11 October 2024