Created
May 27, 2013 01:13
-
-
Save xconnecting/5654671 to your computer and use it in GitHub Desktop.
[Groovy] Flyway Groovy Migration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package db.migration; | |
import com.googlecode.flyway.core.api.migration.jdbc.JdbcMigration; | |
import java.sql.Connection; | |
import java.sql.PreparedStatement; | |
/** | |
* Example of a Groovy-based migration. | |
*/ | |
public class V1_0__Create_person_table implements JdbcMigration { | |
public void migrate(Connection connection) throws Exception { | |
def sql = """\ | |
create table PERSON ( | |
ID int not null, | |
NAME varchar(100) not null | |
);""" | |
PreparedStatement statement = | |
connection.prepareStatement(sql) | |
try { | |
statement.execute() | |
} finally { | |
statement.close() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment