[jOOQ/jOOQ#15201] Remove Migrations::version and Versions.

This commit is contained in:
Lukas Eder 2023-06-15 12:34:01 +02:00
parent fc99f71ccb
commit 73cb9f20ae
6 changed files with 9 additions and 180 deletions

View File

@ -70,16 +70,6 @@ public interface Migrations {
@NotNull
Version version(String id);
/**
* Initialise a {@link Versions} graph.
* <p>
* This is EXPERIMENTAL functionality and subject to change in future jOOQ
* versions.
*/
@Experimental
@NotNull
Versions versions();
/**
* Initialise an empty {@link Commits} graph.
* <p>

View File

@ -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.
* <p>
* The graph is exposed as {@link Iterable} in no defined iteration order.
* <p>
* This is EXPERIMENTAL functionality and subject to change in future jOOQ
* versions.
*
* @author Lukas Eder
*/
@Experimental
public interface Versions extends Iterable<Version> {
/**
* The root version of this graph.
*/
@NotNull
Version root();
/**
* Find a version by its id, or <code>null</code>, if no such version was
* found.
*/
@Nullable
Version get(String id);
}

View File

@ -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;

View File

@ -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

View File

@ -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<Version> 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<Parent> wrap(Version[] parents) {
return map(parents, p -> new Parent((VersionImpl) p, null));
}

View File

@ -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<String, Version> 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<? extends Version> 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<Version> iterator() {
return versions.values().iterator();
}
}