Redgate Flyway

Tutorial - Update PostgreSQL and MySQL filters

Currently, there is no GUI in Flyway Desktop to customize the filter files.

The filter file has to be manually created in one of two ways:

  • create a file called  filter.rgf  in the project folder (next to  flyway.toml)
  • specify a particular file name in  flyway.toml (under redgateCompare.filterFile) and create that file instead

The file format uses JSONC, i.e. JSON syntax but comments are allowed.

Example scenarios

These examples apply to PostgreSQL and MySQL and their forks/variants.

I want to prevent a particular type of object (e.g. views) from being handled by Flyway

{
    "version": "1.1",
    "postFilters":
    [
        {
            "filterBy": "objectType",
            "filterValue": "view",
            "effect": "exclude"
        }
    ]
}

I want to ignore all properties of a particular name e.g. collations

{
    "version": "1.1",
    "postFilters":
    [
        {
            "filterTarget": "property",
            "filterBy": "name",
            "filterValue": "collation",
            "effect": "exclude"
        }
    ]
}

How do I ignore multiple property names and object types e.g. collations and all views

{
    "version": "1.1",
    "postFilters":
    [
        {
            "filterBy": "objectType",
            "filterValue": "view",
            "effect": "exclude"
        },
        {
            "filterTarget": "property",
            "filterBy": "name",
            "filterValue": "collation",
            "effect": "exclude"
        }
    ]
}

PostgreSQL specific example scenarios

These examples apply only to PostgreSQL and its variants

How do I ignore all privileges

{
    "version": "1.1",
    "postFilters":
    [
        {
            "filterTarget": "property",
            "filterBy": "name",
            "filterValue": "privileges",
            "effect": "exclude"
        }
    ]
}

How do I ignore all owners

{
    "version": "1.1",
    "postFilters":
    [
        {
            "filterTarget": "property",
            "filterBy": "name",
            "filterValue": "owner",
            "effect": "exclude"
        }
    ]
}

How do I ignore partitions of a certain partition method/strategy

{
    "version": "1.0",
    "postFilters":
    [
        {
            "filterTarget": "objectType",
            "filterBy": "propertyValue",
            "filterProperty": "partitionInfo.partitionStrategy",
            "filterValue": "HASH",
            "effect": "exclude"
        }
    ]
}

RANGE partitions are ignored by default, how do I include them?

{
    "version": "1.2",
    "postFilters":
    [
        {
            "filterTarget": "objectType",
            "filterBy": "propertyValue",
            "filterProperty": "partitionInfo.partitionStrategy",
            "filterValue": "RANGE",
            "effect": "include"
        }
    ]
}

How do I filter out objects based on their exact name

{
    "version": "1.2",
    "postFilters":
    [
      {
        "filterTarget": "object",
        "filterBy": "fullNameExact",
        "filterValue": ["example_schema", "example_table"],
        "effect": "exclude"
      }
    ]
}

See also

TABLESPACE support can also be enabled using a filter file.



Didn't find what you were looking for?