ebean-orm / ebean-migration

DB Migration runner (similar to Flyway) which can be used standalone or with Ebean (run migrations on EbeanServer start)
Apache License 2.0
9 stars 5 forks source link

Adds a message to log, when running JDBC migration. #61

Closed rPraml closed 5 years ago

rPraml commented 5 years ago

When a JDBC migration is executed, this should also be logged.

Output is now

[main] INFO io.ebean.DDL - Executing run migration version: I__hello - 0 statements
[main] INFO io.ebean.DDL - Executing run migration version: 1.1__initial - 2 statements
[main] INFO io.ebean.DDL - Executing run migration version: 1.2__add_m3 - 3 statements
[main] INFO io.ebean.migration.runner.MigrationTable - Executing jdbc migration version: 1_2_1__test - Dummy jdbc migration
rPraml commented 5 years ago

@rbygrave before you merge this, do you think it would be ok/better to use the io.ebean.DDL logger here, instead of the MigrationTable logger?

rbygrave commented 5 years ago

ok/better to use the io.ebean.DDL logger here ?

That is a good point. I think the answer is yes, it would be better to use io.ebean.DDL.

rPraml commented 5 years ago

That is a good point. I think the answer is yes, it would be better to use io.ebean.DDL.

I was thinking which would be the best:

The MigrationTable may produce the following log statements, that are all DDL related, so I decided to change the logger in MigrationTable.

logger.error("Migration {} requires prior migration {} which has not been run", localVersion.getVersion(), prior.getVersion());
logger.info("patch migration - insert into history {}", local.getLocation());
logger.trace("... skip unchanged migration {}", local.getLocation());
logger.info("patch migration - reset checksum on {}", local.getLocation());
logger.debug("run migration {}", local.getLocation());
logger.info("Executing jdbc migration version: {} - {}", local.getVersion(), migration);
logger.debug("migration skipped by dbInitVersion {}", dbInitVersion);
rbygrave commented 5 years ago

I decided to change the logger in MigrationTable.

Yes, good call !!