IntelliJ IDEA 2020.1 Help

Run migrations

A migration script changes all database or a part of it. For example, you can use migration scripts to add or remove a column, upgrade the database version, or change column properties.

IntelliJ IDEA can automatically generate a migration script but you must check it before running.

You can use a migration tool for the following types of SQL objects: procedures, functions, views, materialized views, rules (PostgreSQL), events (MySQL), scripts (Exasol), triggers (except for PostgreSQL).

Generate a migration script

  1. Select two schemas, right-click any of them, and click Compare. Alternatively, select two schemas and press Ctrl+D.

  2. In the Diff Between <schema_1> and <schema_2> dialog, specify comparing options.

  3. Depending on the migration direction, click Migrate Left or Migrate right.

    Generate a migration script

Modify SQL objects with a migration tool

  1. Double-click the database object.

  2. Make changes in a source code of the object. IntelliJ IDEA highlights all changes in the gutter.

  3. Click the Submit icon (the Submit icon).

  4. In the Object Migration window, review changes and click OK.

    Migrate a database object
Last modified: 15 April 2020