@@ -121,7 +121,7 @@ public int size() {
121121 /**
122122 * Returns the versions that are already applied.
123123 */
124- public Set <String > getVersions () {
124+ public Set <String > versions () {
125125 return migrations .keySet ();
126126 }
127127
@@ -188,7 +188,7 @@ public void unlockMigrationTable() throws SQLException {
188188 */
189189 private void readExistingMigrations () throws SQLException {
190190 for (MigrationMetaRow metaRow : platform .readExistingMigrations (sqlTable , connection )) {
191- addMigration (metaRow .getVersion (), metaRow );
191+ addMigration (metaRow .version (), metaRow );
192192 }
193193 }
194194
@@ -207,14 +207,14 @@ void createTable() throws IOException, SQLException {
207207 * Return the create table script.
208208 */
209209 String createTableDdl () throws IOException {
210- String script = ScriptTransform .replace ("${table}" , sqlTable , getCreateTableScript ());
210+ String script = ScriptTransform .replace ("${table}" , sqlTable , createTableScript ());
211211 return ScriptTransform .replace ("${pk_table}" , sqlPrimaryKey (), script );
212212 }
213213
214214 /**
215215 * Return the create table script.
216216 */
217- private String getCreateTableScript () throws IOException {
217+ private String createTableScript () throws IOException {
218218 // supply a script to override the default table create script
219219 String script = readResource ("migration-support/create-table.sql" );
220220 if (script == null && platformName != null && !platformName .isEmpty ()) {
@@ -233,15 +233,15 @@ private String getCreateTableScript() throws IOException {
233233 }
234234
235235 private String readResource (String location ) throws IOException {
236- Enumeration <URL > resources = getClassLoader ().getResources (location );
236+ Enumeration <URL > resources = classLoader ().getResources (location );
237237 if (resources .hasMoreElements ()) {
238238 URL url = resources .nextElement ();
239239 return IOUtils .readUtf8 (url );
240240 }
241241 return null ;
242242 }
243243
244- private ClassLoader getClassLoader () {
244+ private ClassLoader classLoader () {
245245 return Thread .currentThread ().getContextClassLoader ();
246246 }
247247
@@ -331,7 +331,7 @@ private boolean patchInsertMigration(LocalMigrationResource local, int checksum)
331331 * Return true if the migration should be skipped.
332332 */
333333 boolean skipMigration (int checksum , LocalMigrationResource local , MigrationMetaRow existing ) throws SQLException {
334- boolean matchChecksum = (existing .getChecksum () == checksum );
334+ boolean matchChecksum = (existing .checksum () == checksum );
335335 if (matchChecksum ) {
336336 log .log (TRACE , "skip unchanged migration {0}" , local .location ());
337337 return true ;
@@ -352,7 +352,7 @@ boolean skipMigration(int checksum, LocalMigrationResource local, MigrationMetaR
352352 * Return true if the checksum is reset on the existing migration.
353353 */
354354 private boolean patchResetChecksum (MigrationMetaRow existing , int newChecksum ) throws SQLException {
355- if (isResetOnVersion (existing .getVersion ())) {
355+ if (isResetOnVersion (existing .version ())) {
356356 if (!checkStateOnly ) {
357357 existing .resetChecksum (newChecksum , connection , updateChecksumSql );
358358 }
@@ -428,16 +428,13 @@ private MigrationMetaRow createInitMetaRow() {
428428 * Create the MigrationMetaRow for this migration.
429429 */
430430 private MigrationMetaRow createMetaRow (LocalMigrationResource migration , int checksum , long exeMillis ) {
431-
432431 int nextId = 1 ;
433432 if (lastMigration != null ) {
434- nextId = lastMigration .getId () + 1 ;
433+ nextId = lastMigration .id () + 1 ;
435434 }
436-
437435 String type = migration .type ();
438436 String runVersion = migration .key ();
439437 String comment = migration .comment ();
440-
441438 return new MigrationMetaRow (nextId , type , runVersion , comment , checksum , envUserName , runOn , exeMillis );
442439 }
443440
@@ -464,17 +461,17 @@ private void addMigration(String key, MigrationMetaRow metaRow) {
464461 return ;
465462 }
466463 lastMigration = metaRow ;
467- if (metaRow .getVersion () == null ) {
464+ if (metaRow .version () == null ) {
468465 throw new IllegalStateException ("No runVersion in db migration table row? " + metaRow );
469466 }
470467
471468 migrations .put (key , metaRow );
472- if (VERSION_TYPE .equals (metaRow .getType ()) || BOOTINIT_TYPE .equals (metaRow .getType ())) {
473- MigrationVersion rowVersion = MigrationVersion .parse (metaRow .getVersion ());
469+ if (VERSION_TYPE .equals (metaRow .type ()) || BOOTINIT_TYPE .equals (metaRow .type ())) {
470+ MigrationVersion rowVersion = MigrationVersion .parse (metaRow .version ());
474471 if (currentVersion == null || rowVersion .compareTo (currentVersion ) > 0 ) {
475472 currentVersion = rowVersion ;
476473 }
477- if (BOOTINIT_TYPE .equals (metaRow .getType ())) {
474+ if (BOOTINIT_TYPE .equals (metaRow .type ())) {
478475 dbInitVersion = rowVersion ;
479476 }
480477 }
@@ -555,6 +552,9 @@ public int runNonTransactional() {
555552 return scriptRunner .runNonTransactional ();
556553 }
557554
555+ /**
556+ * Return the count of migrations that were run.
557+ */
558558 public int count () {
559559 return executionCount ;
560560 }
0 commit comments