Redgate Flyway

For PostgreSQL users - where are your DBs hosted?

Tutorial - Configure shadow schema for Oracle

This tutorial assumes that you have configured a development database to use a single schema, e.g. DEV1 

  1. If no shadow database is configured, you will be prompted to configure it from the GUI when navigating to the Generate Migrations tab.
  2. From this screen you can enter the connection details for your shadow database.
    Use all the same credentials as your development database, but enter a different schema, e.g. DEV1_SHADOW

    When setting the shadow database/schema connection, ensure it isn't an important schema as this may be cleaned and rebuilt when generating migration scripts in Flyway Desktop.  There is a checkbox that you must explicitly click to confirm that all the data and schema in the shadow database can be erased.  You will also need to make sure that you have sufficient permissions to clean the schema.

  3. Click Test connection or Test and save to close the dialog and start tracking changes to your development database.
  4. Note that if the schema does not exist but the connection details are otherwise correct, the connection test may succeed, but you will then get an error when trying to perform a comparison using the shadow database. The error will list the schemas that were detected in this scenario.
    1. Once it is configured, the connection details can be altered via the Settings Cog, which will display the following options.
  5. Go to the Schema model page and click on the Static data & comparisons button,
  6. Go to the Comparison options tab
  7. Check Exclude schema names and then click Save (This will ensure migration scripts are generated without explicit schema references, so they can be deployed to the Shadow Schema.)

You can add a shadow database environment configuration to your toml configuration file or user configuration file as follows:

  1. [environments.shadow]
  2. url = "jdbc:oracle:thin:@//localhost:1521/Dev1"
  3. user = "sa"
  4. password = "..."
  5. schemas = ["DEV1_SHADOW"]

 Also ensure that the following option is set to true in the toml configuration file:

  1. [redgateCompare.oracle.options.behavior]
  2. excludeSchemaNames = true

 This will ensure migration scripts are generated without explicit schema references, so they can be deployed to the Shadow Schema.

Next steps

Pick one of:

  • Validate migration deployment
  • Generate migrations (note that this validates migration deployment as part of comparing against migrations)
  • Baseline (prerequisite for generating migrations if you do not have any yet, unless working on a completely greenfield database)

Didn't find what you were looking for?