Skip to content

Options

The command line version of migra includes a number of options for getting the diff output you desire. If using the API, similarly named options are available on the Migration object.

--schema [SCHEMA_NAME]

Specify a single schema to diff.

--create-extensions-only

Only output create extension statements, nothing else. This is useful when you have extensions as part of a setup script for a single schema: Those extensions need to be installed, but extensions are usually not installed in a custom schema.

You'd generate a setup script in two steps:

  1. Generate the necessary create extension if not exists... statements.
  2. Generate the schema changes with --schema-only.
  3. Combine the output of 1 and 2 into a single database sync script.

--include-permissions

This tells migra to spit out permission-related change statements (grant/revoke). This is False by default: Often one is comparing databases from different environments, where the users and permissions are completely different and not something one would want to sync.