diff --git a/jOOQ/src/main/java/org/jooq/Migrations.java b/jOOQ/src/main/java/org/jooq/Migrations.java index 049aaad4e1..7469343124 100644 --- a/jOOQ/src/main/java/org/jooq/Migrations.java +++ b/jOOQ/src/main/java/org/jooq/Migrations.java @@ -70,16 +70,6 @@ public interface Migrations { @NotNull Version version(String id); - /** - * Initialise a {@link Versions} graph. - *

- * This is EXPERIMENTAL functionality and subject to change in future jOOQ - * versions. - */ - @Experimental - @NotNull - Versions versions(); - /** * Initialise an empty {@link Commits} graph. *

diff --git a/jOOQ/src/main/java/org/jooq/Versions.java b/jOOQ/src/main/java/org/jooq/Versions.java deleted file mode 100644 index 8619913f18..0000000000 --- a/jOOQ/src/main/java/org/jooq/Versions.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Other licenses: - * ----------------------------------------------------------------------------- - * Commercial licenses for this work are available. These replace the above - * ASL 2.0 and offer limited warranties, support, maintenance, and commercial - * database integrations. - * - * For more information, please visit: https://www.jooq.org/legal/licensing - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -package org.jooq; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.ApiStatus.Experimental; - -/** - * A directed, acyclic graph of {@link Version} objects. - *

- * The graph is exposed as {@link Iterable} in no defined iteration order. - *

- * This is EXPERIMENTAL functionality and subject to change in future jOOQ - * versions. - * - * @author Lukas Eder - */ -@Experimental -public interface Versions extends Iterable { - - /** - * The root version of this graph. - */ - @NotNull - Version root(); - - /** - * Find a version by its id, or null, if no such version was - * found. - */ - @Nullable - Version get(String id); -} diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultDSLContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultDSLContext.java index e1138f423f..0617665cdd 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultDSLContext.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultDSLContext.java @@ -100,7 +100,6 @@ import org.jooq.BatchedRunnable; import org.jooq.BindContext; import org.jooq.Block; import org.jooq.Catalog; -import org.jooq.Commits; import org.jooq.CommonTableExpression; import org.jooq.Condition; import org.jooq.Configuration; @@ -176,7 +175,6 @@ import org.jooq.MergeKeyStep9; import org.jooq.MergeKeyStepN; import org.jooq.MergeUsingStep; import org.jooq.Meta; -import org.jooq.Migration; import org.jooq.Name; import org.jooq.Param; import org.jooq.Parser; @@ -240,8 +238,6 @@ import org.jooq.UDTRecord; import org.jooq.UpdatableRecord; import org.jooq.UpdateQuery; import org.jooq.UpdateSetFirstStep; -import org.jooq.Version; -import org.jooq.Versions; import org.jooq.WithAsStep; import org.jooq.WithAsStep1; import org.jooq.WithAsStep10; diff --git a/jOOQ/src/main/java/org/jooq/impl/MigrationsImpl.java b/jOOQ/src/main/java/org/jooq/impl/MigrationsImpl.java index bb9a8180a6..386412a1ad 100644 --- a/jOOQ/src/main/java/org/jooq/impl/MigrationsImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/MigrationsImpl.java @@ -47,7 +47,6 @@ import org.jooq.File; import org.jooq.Migration; import org.jooq.Migrations; import org.jooq.Version; -import org.jooq.Versions; /** * @author Lukas Eder @@ -67,12 +66,7 @@ final class MigrationsImpl implements Migrations { @Override public final Version version(String id) { - return new VersionImpl(ctx, id, null, null, new Version[0]); - } - - @Override - public final Versions versions() { - return new VersionsImpl(version("init")); + return new VersionImpl(ctx, id); } @Override diff --git a/jOOQ/src/main/java/org/jooq/impl/VersionImpl.java b/jOOQ/src/main/java/org/jooq/impl/VersionImpl.java index 307bb35add..bbcfdf3a83 100644 --- a/jOOQ/src/main/java/org/jooq/impl/VersionImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/VersionImpl.java @@ -38,6 +38,7 @@ package org.jooq.impl; import static java.lang.Boolean.TRUE; +import static java.util.Arrays.asList; import static java.util.Collections.emptyList; import static java.util.Collections.unmodifiableList; import static org.jooq.impl.DSL.createSchema; @@ -103,6 +104,13 @@ final class VersionImpl extends AbstractNode implements Version { this(ctx, id, meta, root, wrap(parents)); } + /** + * Create the root {@link Version}. + */ + VersionImpl(DSLContext ctx, String id) { + this(ctx, id, null, null, asList()); + } + private static List wrap(Version[] parents) { return map(parents, p -> new Parent((VersionImpl) p, null)); } diff --git a/jOOQ/src/main/java/org/jooq/impl/VersionsImpl.java b/jOOQ/src/main/java/org/jooq/impl/VersionsImpl.java deleted file mode 100644 index fc2bb62369..0000000000 --- a/jOOQ/src/main/java/org/jooq/impl/VersionsImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Other licenses: - * ----------------------------------------------------------------------------- - * Commercial licenses for this work are available. These replace the above - * ASL 2.0 and offer limited warranties, support, maintenance, and commercial - * database integrations. - * - * For more information, please visit: https://www.jooq.org/legal/licensing - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -package org.jooq.impl; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.jooq.Version; -import org.jooq.Versions; - -/** - * @author Lukas Eder - */ -final class VersionsImpl implements Versions { - - final Version root; - final Map versions; - - VersionsImpl(Version root) { - this.root = root; - this.versions = new HashMap<>(); - - add(root); - } - - void add(Version version) { - versions.put(version.id(), version); - } - - void addAll(Collection v) { - for (Version version : v) - add(version); - } - - void remove(Version version) { - versions.remove(version.id()); - } - - @Override - public final Version root() { - return root; - } - - @Override - public final Version get(String id) { - return versions.get(id); - } - - @Override - public final Iterator iterator() { - return versions.values().iterator(); - } -}