Redgate Flyway

Using a subset of schemas in a SQL Server database

This is useful if multiple teams are working on different schemas in the same database.

Initial setup

  1. Create a Flyway Desktop Project.

  2. Configure your development database.

Filter the project to just the schemas you're interested in

  1. Use SQL Compare to edit the Filter.scpf file to the schemas you are interested in.
    1. Use the development database as your source and target for the comparison and click Compare.

    2. Open the Filter.scpf file that's in your Flyway Desktop project.


    3. Click Custom filter rules... and limit the Schema name to the schemas you're interested.  If you need multiple schemas, then use the Add OR Clause.


    4. If needed, uncheck the Roles and Schemas to exclude these as well
    5. Press OK to close the Edit filter rules dialog and click the blue save icon to save the Filter.scpf file.


Setup the schemas in the Flyway configuration

  1. Open the flyway.toml file in the project folder.  If you are on an older version, open the flyway.conf.

  2. Update the schema information to the schemas you are tracking in a comma separated list. 

    flyway.tomlflyway.conf
    [flyway]
    ...
    schemas = <schema1>, <schema2>
    ...

    flyway.schemas=<schema1>, <schema2>

    Note: Remove the # at the front of the line so it's not commented out


  3. Optionally, uncomment the following line and enter the schema where you want the flyway_schema_history table to be maintained.  This is only needed if the first entry in flyway.schemas is not where you want to track this table. 

    flyway.tomlflyway.conf
    [flyway]
    ...
    defaultSchema = <schemaX>
    ...

    flyway.defaultSchema=<schemaX>

    Note: Remove the # at the front of the line so it's not commented out

Next Steps

  1. Refresh the Schema Model tab.  Now you should only see the objects in the schema(s) that you are interested in for this project.  You can now select which objects you want to save and continue working with Flyway Desktop.   



Didn't find what you were looking for?