Skip to content

Commit 1b53b8e

Browse files
committed
no more LATEST default
1 parent 183cfbd commit 1b53b8e

File tree

2 files changed

+11
-5
lines changed
  • persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc
  • polaris-core/src/main/java/org/apache/polaris/core/persistence/bootstrap

2 files changed

+11
-5
lines changed

persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/DatabaseType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ public InputStream getInitScriptResource(@Nonnull SchemaOptions schemaOptions) {
5555
} catch (IOException e) {
5656
throw new IllegalArgumentException("Unable to load file " + schemaOptions.schemaFile(), e);
5757
}
58-
} else {
58+
} else if {
5959
final String schemaSuffix;
6060
switch (schemaOptions.schemaVersion()) {
61+
case null -> schemaSuffix = "schema-v1.sql";
6162
case SchemaOptions.LATEST -> schemaSuffix = "schema-v1.sql";
6263
case "1" -> schemaSuffix = "schema-v1.sql";
6364
default ->

polaris-core/src/main/java/org/apache/polaris/core/persistence/bootstrap/SchemaOptions.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,16 @@
2727
public interface SchemaOptions {
2828
public static final String LATEST = "LATEST";
2929

30-
@Value.Default
31-
default String schemaVersion() {
32-
return LATEST;
33-
}
30+
@Nullable
31+
String schemaVersion();
3432

3533
@Nullable
3634
String schemaFile();
35+
36+
@Value.Check
37+
default void validate() {
38+
if (schemaVersion() != null && schemaFile() != null) {
39+
throw new IllegalStateException("Only one of schemaVersion or schemaFile can be set.");
40+
}
41+
}
3742
}

0 commit comments

Comments
 (0)