How can we help you today? How can we help you today?

Rule out directories from the flyway.locations

Currently we are using flyway to deploy our code base to a Microsoft SQL server. For the Location we specify directories: flyway.locations=filesystem:src/test/resources/views/UserAcceptance/**

But we have some views that are already developed but the underlying tables are not deployed yet. So I want to rule out for example all directories starting with a character like ##.

Just an example what I want to achieve:

- UserAcceptance/Test1/SQL1.sql (I want to deploy this)
- UserAcceptance/Test1/SQL2.sql (I want to deploy this)
- UserAcceptance/Test2/SQL1.sql (I want to deploy this) 
- UserAcceptance/Test2/SQL2.sql (I want to deploy this)
- UserAcceptance/##Test3/SQL1.sql (I want to rule out this)
- UserAcceptance/Test4/SQL1.sql (I want to deploy this) 

Thanks for your help in advance
HenkFromKLM
0

Comments

1 comment

  • Peter_Laws
    Hello HenkFromKLM,

    We don't have any logic in flyway for conditional logic on locations, however you could achieve this through deploy rules.

    The above is for Flyway Desktop but leverages flyway cli behaviour which can also be manually configured using a shouldExecute definition.

    The TL:DR of it is for 'UserAcceptance/##Test3/SQL1.sql ' you can give it an execution criteria that cannot be met, so it's skipped.

    E.G
    shouldExecute=(${environment}==UAT)


    Would ensure this is only deployed to UAT and no further, or you could define a target that doesn't exist, keeping it in limbo until you need it. This has the added benefit that your exclusion criteria will also be held in version control, so your colleagues will have parity with yourself.
    Peter_Laws
    0

Add comment

Please sign in to leave a comment.