tlberglund / groovy-liquibase

Yet Another Groovy DSL for Liquibase
Other
85 stars 66 forks source link

RDBMS conditional #20

Closed jeroenvs closed 9 years ago

jeroenvs commented 13 years ago

Allow specific sections of a change log to be used for only one type of RDBMS. This would allow us to do things such as:

changeSet() { createTable(tableName: "address") { column(autoIncrement: true, name: "id", type: "BIGINT") { constraints(nullable: false, primaryKey: true) } } rdbms('hsqldb') { sql('x') } other { sql('y') } // do something else }

So, the following change sets would be semantically equal:

changeSet(rdbms: 'mysql') { ... }

changeSet() { rdbms('mysql') { ... } }

jeroenvs commented 13 years ago

Another option would be to provide access to the Liquibase Database instance. Allowing us to do:

if(database.typeName == "hsqldb") { sql(x); } else { sql(y); }

stevesaliman commented 9 years ago

Liquibase itself has support for this sort of thing. It is a property that can be included in a changeset, named dbms, which the DSL also supports.