Monday, September 16, 2013

GRAILS Liquibase migration - Execute / run a sql file

The sqlFile method can be used to run a sql file directly from liquibase. Below is the DSL on how this can be done using liquibase and GRAILS.
databaseChangeLog = {

    changeSet(author: "myname", id: "1234567-1") {
        sqlFile( path: 'path-to-sql-file.sql')
    }

}

Make sure the app has permissions to read the file.