MCPcopy Index your code
hub / github.com/jOOQ/jOOQ / execute0

Method execute0

jOOQ/src/main/java/org/jooq/impl/MigrationImpl.java:417–530  ·  view source on GitHub ↗
(boolean baseline)

Source from the content-addressed store, hash-verified

415 }
416
417 void execute0(boolean baseline) {
418
419 // TODO: Transactions don't really make sense in most dialects. In some, they do
420 // e.g. PostgreSQL supports transactional DDL. Check if we're getting this right.
421 run(() -> {
422 DefaultMigrationContext ctx = migrationContext(baseline);
423 MigrationListener listener = new MigrationListeners(configuration);
424
425 if (!FALSE.equals(dsl().settings().isMigrationAutoVerification()))
426 verify0(ctx);
427
428 init(baseline);
429
430 try {
431 listener.migrationStart(ctx);
432 int untracked = ctx.revertUntrackedQueries.queries().length;
433
434 if (baseline) {
435 if (history.available()
436 && history.current().version().id().equals(to().id())
437 && untracked == 0
438 ) {
439 if (log.isInfoEnabled())
440 log.info("Current version is already set to baseline version: " + to().id());
441
442 return;
443 }
444
445 if (log.isInfoEnabled())
446 log.info("Setting baseline to " + to().id());
447
448 if (untracked == 0) {
449 createRecord(ctx, SUCCESS, from(), to(), "New baseline");
450 }
451 else {
452 if (log.isInfoEnabled())
453 log.info("Reverting untracked changes (number of queries: " + untracked + ")");
454
455 StopWatch watch = new StopWatch();
456 HistoryRecord record = createRecord(ctx, STARTING, from(), to(), "New baseline");
457
458 try {
459 log(watch, record, REVERTING);
460 revertUntracked(ctx, listener, record);
461 log(watch, record, SUCCESS);
462 }
463 catch (Exception e) {
464 StringWriter s = new StringWriter();
465 e.printStackTrace(new PrintWriter(s));
466
467 if (log.isErrorEnabled())
468 log.error("Setting " + to().id() + " as baseline failed: " + e.getMessage());
469
470 log(watch, record, FAILURE, OPEN, s.toString());
471 throw new DataMigrationRedoLogException(record, e);
472 }
473 }
474

Callers 2

baselineMethod · 0.95
executeMethod · 0.95

Calls 15

runMethod · 0.95
migrationContextMethod · 0.95
verify0Method · 0.95
initMethod · 0.95
migrationStartMethod · 0.95
toMethod · 0.95
createRecordMethod · 0.95
fromMethod · 0.95
logMethod · 0.95
revertUntrackedMethod · 0.95
fromSnapshotMethod · 0.95
queriesMethod · 0.95

Tested by

no test coverage detected