Skip to content

Commit

Permalink
improve startup performance (DAT-18327) (liquibase#6366)
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenMassaro authored Oct 10, 2024
1 parent d1dcdde commit 946f4e4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,7 @@ protected ClassLoader configureClassLoader() throws IllegalArgumentException {

private void addSubcommand(CommandDefinition commandDefinition, CommandLine rootCommand) {
List<String[]> commandNames = expandCommandNames(commandDefinition);
Boolean showHidden = LiquibaseCommandLineConfiguration.SHOW_HIDDEN_ARGS.getCurrentValue();

boolean showCommand = true;
for (String[] commandName : commandNames) {
Expand Down Expand Up @@ -991,7 +992,7 @@ private void addSubcommand(CommandDefinition commandDefinition, CommandLine root
if (i > 0) {
builder.hidden(true);
} else {
builder.hidden(def.getHidden() && !LiquibaseCommandLineConfiguration.SHOW_HIDDEN_ARGS.getCurrentValue());
builder.hidden(def.getHidden() && !showHidden);
}

subCommandSpec.addOption(builder.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import liquibase.command.CommandBuilder;
import liquibase.command.CommandScope;
import liquibase.exception.CommandValidationException;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -33,7 +32,7 @@ public abstract class AbstractChangelogCommandStep extends AbstractCommandStep {
.defaultValue("none").description("Sets runOnChange=\"true\" for changesets containing solely changes of these types (e. g. createView, createProcedure, ...).").build();
REPLACE_IF_EXISTS_TYPES_ARG = builder.argument("replaceIfExistsTypes", String.class)
.defaultValue("none")
.description(String.format("Sets replaceIfExists=\"true\" for changes of these types (supported types: %s)", StringUtils.join(REPLACE_IF_EXISTS_TYPES_NAMES, ", "))).build();
.description("Sets replaceIfExists=\"true\" for changes of these types (supported types: createProcedure, createView)").build();
SKIP_OBJECT_SORTING = builder.argument("skipObjectSorting", Boolean.class)
.defaultValue(false)
.description("When true will skip object sorting. This can be useful on databases that have a lot of packages/procedures that are " +
Expand All @@ -56,7 +55,7 @@ protected static void validateReplaceIfExistsTypes(final CommandScope commandSco
supportedReplaceIfExistsTypes.add("none");
replaceIfExistsTypes.removeAll(supportedReplaceIfExistsTypes);
if (!replaceIfExistsTypes.isEmpty())
throw new CommandValidationException("Invalid types for --replace-if-exists-types: " + replaceIfExistsTypes.stream().collect(Collectors.joining(", ")));
throw new CommandValidationException("Invalid types for --replace-if-exists-types: " + replaceIfExistsTypes.stream().collect(Collectors.joining(", ")) + ". Valid types are: " + REPLACE_IF_EXISTS_TYPES_NAMES.stream().collect(Collectors.joining(", ")));
}

protected static Stream<String> supportedRunOnChangeTypes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,11 +790,12 @@ public static String toKabobCase(String string) {
return null;
}

if (string.length() == 1) {
int length = string.length();
if (length == 1) {
return string;
}

StringBuilder outString = new StringBuilder();
StringBuilder outString = new StringBuilder(length);
char[] charString = string.toCharArray();
for (int i = 0; i < charString.length; i++) {
char letter = charString[i];
Expand Down

0 comments on commit 946f4e4

Please sign in to comment.