[jOOQ/jOOQ#9506] Added public Version.parents() method

This commit is contained in:
Lukas Eder 2019-12-18 11:46:51 +01:00
parent ec1768245b
commit 350f995030
2 changed files with 17 additions and 0 deletions

View File

@ -38,6 +38,7 @@
package org.jooq;
import java.util.Collection;
import java.util.List;
import org.jooq.conf.Settings;
@ -79,6 +80,11 @@ public interface Version {
*/
Version root();
/**
* Get the parent versions of this version.
*/
List<Version> parents();
/**
* Commit a new {@link Meta} representation to the version graph.
* <p>

View File

@ -38,6 +38,7 @@
package org.jooq.impl;
import static java.lang.Boolean.TRUE;
import static java.util.Collections.unmodifiableList;
import static org.jooq.impl.DSL.createSchema;
import static org.jooq.impl.DSL.name;
import static org.jooq.impl.DSL.schema;
@ -128,6 +129,16 @@ final class VersionImpl implements Version {
return result;
}
@Override
public final List<Version> parents() {
List<Version> result = new ArrayList<>(parents.size());
for (Parent parent : parents)
result.add(parent.version);
return unmodifiableList(result);
}
@Override
public final Version apply(String newId, Query... migration) {
return apply(newId, ctx.queries(migration));