Commits

Takumi IINO  committed 905dfab

add example

  • Participants
  • Parent commits adc68c8

Comments (0)

Files changed (2)

File example/config.groovy

+schemaUpdate {
+    tableName = "schema_version"
+    createTable = """
+CREATE TABLE IF NOT EXISTS schema_version (
+    id INT NOT NULL AUTO_INCREMENT COMMENT 'ID',
+    phase TEXT DEFAULT 0 NOT NULL COMMENT 'pharse',
+    version INT DEFAULT 0 NOT NULL COMMENT 'version'
+);
+"""
+}
+
+jdbc {
+    url = "jdbc:h2:MyDB"
+    user = "troter"
+    password = ""
+    driverClassName = "org.h2.Driver"
+}

File example/migrate.groovy

+import groovy.grape.*
+import jp.troter.tools.schema_update.*
+
+@GrabConfig(systemClassLoader=true)
+@GrabResolver(name='troter.jp', root='http://troter.jp/maven2/release')
+@Grapes(
+    [@Grab(group='jp.troter.tools', module='schema-update', version='0.1'),
+     @Grab(group='com.h2database', module='h2', version='1.3.158')])
+class Main {
+    public static void main(String[] args) {
+        ConfigurationHolder.load(new File('config.groovy'))
+        def runner = new Runner(new File('migration'))
+        runner.run()
+    }
+}