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

Files in schema model having different extensions

For an Oracle database, I am exporting the DDL and saving the files into my schema-model.  Is it possible to use files with extension other than .sql (e.g. .prc for procedures, .trg for triggers, .pkg for packages, etc)?

Brian
1

Comments

3 comments

  • Jon Kirkwood
    Official comment

    Hi Brian 

    Thank you for reaching out on the Redgate forums with your Flyway extension inquiry. 

    Yes, this may be supported in Flyway for your requirements.

     

    By default, Flyway scans for .sql file types to read in for migrations.

    However, you can configure additional suffixes using the flyway.sqlMigrationSuffixes setting, for example:

    flyway.sqlMigrationSuffixes=.sql,.pkg,.pkb,.prc,.trg

    Documentation:
    https://documentation.red-gate.com/flyway/reference/configuration/flyway-namespace/flyway-sql-migration-suffixes-setting

     

    That said, while it’s possible, it does add complexity. 

    All environments (developers, CI, build agents) would need to use the same configuration, and it moves away from Flyway’s default conventions.

     

    Flyway determines object type from the SQL inside the file (not the extension), which means in most cases, keeping everything as .sql is the simpler and more maintainable approach.

     

    The sqlMigrationSuffixes setting is not maintained through Flyway Desktop. You would need to modify your configuration file directly. 

    Information on the expected layout of this field can be found on the link provided above.

     

    Hope this helps with your project and filetype naming.

    Jon Kirkwood
  • Brian

    Thanks for the reply, Jon.  I tried adding the sqlMigrationSuffixes setting to our .toml file (Flyway Desktop), however the objects for which the DDL files have different extensions still were not picked up in the schema model.  I will have to revert to prefixing the file names with the object types.  Some database tools (e.g. Toad for Oracle) save the files with different extensions to indicate the type of object being created. Even though the files are stored in separate folders in our repository, it's our preference to also have distinguishing naming conventions, and I was hoping to keep these extensions.

    Brian
    0
  • Jon Kirkwood

    Thanks for testing and reporting back, apologies the initial response wasn't clear on this.

    The sqlMigrationSuffixes setting only applies to the migrations folder, not the schema model. 

    The schema model expects .sql files only and this isn't currently configurable, which is why non-sql files types weren't being picked up.

     

    On reflection, it does seem that your prefix-based naming approach is the right workaround here. It's also worth noting that Flyway Desktop automatically organises schema model objects into subfolders by type (procedures/, triggers/, etc.), so the folder structure itself provides the object-type context even with a uniform .sql extension.

     

    If you'd like to see configurable extensions supported in the schema model, you're welcome to raise or upvote it on our Flyway UserVoice portal: http://redgate.uservoice.com/forums/949477-flyway

    UserVoice is our feature request site run by our product managers and development teams to help shape the features and functionality of all of our tools, including Flyway. 

     

    Jon Kirkwood
    1

Add comment

Please sign in to leave a comment.