Skip to content

Commit ebc297b

Browse files
committed
connection
1 parent 5150d33 commit ebc297b

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ buildscript {
1010
}
1111

1212
group 'info.purocean'
13-
version '1.0'
13+
version '1.1.0'
1414

1515
apply plugin: 'kotlin'
1616
apply plugin: 'maven-publish'
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package info.purocean.dbmigration
22

3+
import java.sql.Connection
4+
35
interface CodeMigration <in T> {
4-
fun run(context: T)
5-
}
6+
fun run(context: T, connection: Connection)
7+
}

src/main/kotlin/info/purocean/dbmigration/DB.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ class DB(dbUrl: String, dbUsername: String, dbPassword: String) {
8888
this.conn.close()
8989
}
9090

91+
fun getConnection (): Connection {
92+
return this.conn
93+
}
94+
9195
private fun getStmt (): Statement {
9296
return this.conn.createStatement()
9397
}

src/main/kotlin/info/purocean/dbmigration/Migrate.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class Migrate(dbUrl: String, dbUsername: String, dbPassword: String, private var
6868

6969
val obj = cls.newInstance()
7070

71-
cls.getMethod("run", Object::class.java).invoke(obj, context)
71+
cls.getMethod("run", Object::class.java).invoke(obj, context, this.db.getConnection())
7272
}
7373

7474
this.db.writeRecord(migration)

0 commit comments

Comments
 (0)