Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAT-8601: Init Project command #2263

Merged
merged 52 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
4f0af6e
Fix issue with ConfiguredValue.wasDefaultValueUsed method
wwillard7800 Dec 3, 2021
acfc833
Added a comment
wwillard7800 Dec 3, 2021
5efcb09
Merge remote-tracking branch 'origin/master' into DAT-8724
wwillard7800 Dec 7, 2021
463e0b8
Potential fix for JDK 16 issue in CommandTests
wwillard7800 Dec 7, 2021
9645275
Merge remote-tracking branch 'origin/DAT-8640' into DAT-8724
wwillard7800 Dec 7, 2021
6dbd452
Merge remote-tracking branch 'origin/master' into DAT-8724
wwillard7800 Dec 8, 2021
19493bc
Merge remote-tracking branch 'origin/DAT-8601' into DAT-8640
nvoxland Dec 8, 2021
2c70056
Move interactive prompting logic into core module (DAT-8642) (#2255)
StevenMassaro Dec 9, 2021
f9dd0ad
LB-2177
wwillard7800 Dec 9, 2021
4402828
LB-2177
wwillard7800 Dec 9, 2021
3432f04
LB-2177
wwillard7800 Dec 9, 2021
a0c466d
Merge remote-tracking branch 'origin/DAT-8601' into DAT-8724
wwillard7800 Dec 10, 2021
41ac86f
Merge pull request #2250 from liquibase/DAT-8640
wwillard7800 Dec 10, 2021
9e5de74
Merge remote-tracking branch 'origin/DAT-8601' into DAT-8724
wwillard7800 Dec 10, 2021
a69006c
LB-2177
wwillard7800 Dec 10, 2021
6c1e0cb
Merge remote-tracking branch 'origin/master' into DAT-8601
suryaaki Dec 10, 2021
a2af161
Merge pull request #2264 from liquibase/LB-2177
suryaaki2 Dec 10, 2021
15e15bb
Merge remote-tracking branch 'origin/DAT-8601' into DAT-8724
wwillard7800 Dec 10, 2021
145ad99
Fixed issues with sample JSON changelog
wwillard7800 Dec 13, 2021
ac8bb4c
Merge remote-tracking branch 'origin/DAT-8601' into DAT-8724
wwillard7800 Dec 13, 2021
b55b756
Another sample changelog modification
wwillard7800 Dec 13, 2021
422a406
Merge remote-tracking branch 'origin/DAT-8601' into DAT-8724
wwillard7800 Dec 13, 2021
6b406df
Revert "Move interactive prompting logic into core module (DAT-8642) …
StevenMassaro Dec 14, 2021
9647891
Merge remote-tracking branch 'origin/master' into DAT-8724
wwillard7800 Dec 14, 2021
b5b2228
Merge remote-tracking branch 'origin/DAT-8601' into DAT-8724
wwillard7800 Dec 14, 2021
ce9e19a
Modified yaml sample changelog
wwillard7800 Dec 15, 2021
5fa3257
when reprompting for input after an invalid value, show the default v…
StevenMassaro Dec 15, 2021
70e11e7
interactively prompt for input from the init project command
StevenMassaro Dec 15, 2021
e8ed407
Renamed example files
wwillard7800 Dec 15, 2021
d985c53
Fix doc issues in files
wwillard7800 Dec 15, 2021
8258156
Fix prompt bug and add "run after method" logic to command tests (DAT…
StevenMassaro Dec 20, 2021
0f552dc
Merge remote-tracking branch 'origin/DAT-8601' into DAT-8784
wwillard7800 Dec 20, 2021
c2e7bff
Merge remote-tracking branch 'origin/master' into DAT-8784
wwillard7800 Dec 21, 2021
872dbf7
Merge remote-tracking branch 'origin/master' into DAT-8601
wwillard7800 Dec 21, 2021
bb63ee3
Merge remote-tracking branch 'origin/DAT-8601' into DAT-8601
wwillard7800 Dec 21, 2021
7ca59c6
Merge remote-tracking branch 'origin/DAT-8601' into DAT-8784
wwillard7800 Dec 21, 2021
0e4d091
Added output capture to TestUI class
wwillard7800 Dec 22, 2021
e442f13
Merge branch 'master' into DAT-8601
StevenMassaro Dec 22, 2021
71d6af1
Merge remote-tracking branch 'origin/master' into DAT-8601
wwillard7800 Dec 22, 2021
02472bb
Remove unused file
wwillard7800 Dec 23, 2021
4e80b76
Merge pull request #2291 from liquibase/DAT-8784
suryaaki2 Dec 23, 2021
8fb819c
remove InteractivePromptingValueProvider
suryaaki Dec 23, 2021
17227e3
remvoe InteractivePromptingValueProvider
suryaaki Dec 23, 2021
7afe513
Merge remote-tracking branch 'origin/DAT-8601' into DAT-8601
wwillard7800 Dec 23, 2021
f5e0617
Merge remote-tracking branch 'origin/master' into DAT-8601
wwillard7800 Dec 23, 2021
d7ebf6e
ensure that the most recently created changelog file is prompted for
StevenMassaro Dec 27, 2021
c61c965
Merge remote-tracking branch 'origin/DAT-8601' into DAT-8601
wwillard7800 Dec 27, 2021
81ecda7
Merge remote-tracking branch 'origin/master' into DAT-8601
suryaaki Dec 28, 2021
44dba24
Merge remote-tracking branch 'origin/master' into DAT-8601
suryaaki Dec 29, 2021
cba16c9
Merge branch 'master' into DAT-8601
StevenMassaro Dec 29, 2021
af8230c
Use correct path to H2 jar in startup script
wwillard7800 Jan 3, 2022
d577655
Merge remote-tracking branch 'origin/DAT-8601' into DAT-8601
wwillard7800 Jan 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -468,7 +468,6 @@ public int getPrecedence() {
Scope.getCurrentScope().getLog(getClass()).fine("Cannot find local defaultsFile " + defaultsFile.getAbsolutePath());
}


return returnList;
}

Expand Down
Expand Up @@ -58,6 +58,13 @@ public CommandDefinition getCommand() {
return commandDefinition;
}

/**
* Returns the complete config prefix (without a trailing period) for the command in this scope.
* @return
*/
public String getCompleteConfigPrefix() {
return completeConfigPrefix;
}

/**
* Adds the given key/value pair to the stored argument data.
Expand Down
Expand Up @@ -26,7 +26,7 @@ public class UpdateCommandStep extends AbstractCliWrapperCommandStep {
CommandBuilder builder = new CommandBuilder(COMMAND_NAME, LEGACY_COMMAND_NAME);

URL_ARG = builder.argument("url", String.class).required()
.description("The JDBC database connection URL").build();
.description("The JDBC database connection URL").build();
DEFAULT_SCHEMA_NAME = builder.argument("defaultSchemaName", String.class)
.description("The default schema name to use for the database connection").build();
DEFAULT_CATALOG_NAME_ARG = builder.argument("defaultCatalogName", String.class)
Expand Down
Expand Up @@ -45,7 +45,6 @@ public DataType getValueObfuscated() {
return rawValue;
}


/**
* Returns the "winning" value across all the possible {@link ConfigurationValueProvider}.
* A {@link ProvidedValue} is always returned, even if the value was not configured.
Expand All @@ -56,15 +55,16 @@ public ProvidedValue getProvidedValue() {
return getProvidedValues().get(0);
}


/**
*
* Return true if a default value was the "winning" value
*
* @return boolean
*
*/
public boolean wasDefaultValueUsed() {
for (ProvidedValue providedValue : this.getProvidedValues()) {
if (providedValue.getProvider() != null && providedValue.getProvider() instanceof ConfigurationDefinition.DefaultValueProvider) {
return true;
}
}

return false;
ProvidedValue winningProvidedValue = getProvidedValue();
return winningProvidedValue != null && winningProvidedValue.getProvider() instanceof ConfigurationDefinition.DefaultValueProvider;
}

/**
Expand Down
Expand Up @@ -113,7 +113,7 @@ public <T> T prompt(String prompt, T valueIfNoEntry, InputHandler<T> inputHandle
message = "Invalid value: \"" + input + "\"";
}
this.sendMessage(message);
this.sendMessage(prompt + ": ");
this.sendMessage(initialMessage + ": ");
}
}
}
Expand Down
Expand Up @@ -11,7 +11,7 @@ private FileUtil() {
throw new IllegalStateException("This utility class must not be instantiated. Sorry.");
}

public static String getContents(File file) throws IOException {
public static String getContents(File file) throws IOException {
if (!file.exists()) {
return null;
}
Expand Down
@@ -0,0 +1,18 @@
{ "databaseChangeLog": [
"changeset": {
"id": "1",
"author": "your.name",
"changes": [
{
}
]
},
"changeset": {
"id": "2",
"author": "your.name",
"changes": [
{
}
]
}
]}
@@ -0,0 +1,120 @@
{ "databaseChangeLog": [
{
"changeSet": {
"id": "1",
"author": "your.name",
"changes": [
{
"createTable": {
"tableName": "person",
"columns": [
{
"column": {
"name": "id",
"type": "int",
"autoIncrement": true,
"constraints": {
"primarykey": true,
"nullable": false
}
}
},
{
"column": {
"name": "name",
"type": "varchar(50)"
}
},
{
"column": {
"name": "addresss1",
"type": "varchar(50)"
}
},
{
"column": {
"name": "addresss2",
"type": "varchar(50)"
}
},
{
"column": {
"name": "city",
"type": "varchar(30)"
}
}
]
}
}]
}
},
{
"changeSet": {
"id": "2",
"author": "your.name",
"changes": [
{
"createTable": {
"tableName": "company",
"columns": [
{
"column": {
"name": "id",
"type": "int",
"autoIncrement": true,
"constraints": {
"primarykey": true,
"nullable": false
}
}
},
{
"column": {
"name": "name",
"type": "varchar(50)"
}
},
{
"column": {
"name": "addresss1",
"type": "varchar(50)"
}
},
{
"column": {
"name": "addresss2",
"type": "varchar(50)"
}
},
{
"column": {
"name": "city",
"type": "varchar(30)"
}
}
]
}
}]
}
},
{
"changeSet": {
"id": "3",
"author": "your.name",
"changes": [
{
"addColumn": {
"tableName": "company",
"columns": [
{
"column": {
"name": "country",
"type": "varchar(2)"
}
}
]
}
}]
}
}
]}
@@ -0,0 +1,30 @@
"changeSet": {
"id": "1",
"author": "dev",
"changes": [
{
"createTable": {
"tableName": "person",
"columns": [
{
"column": {
"name": "id",
"type": "int",
"autoIncrement": true,
"constraints": {
"primaryKey": true,
"nullable": false
}
}
},
{
"column": {
"name": "name",
"type": "varchar(255)"
}
}
]
}
}
]
}
Expand Up @@ -20,7 +20,7 @@
## The url H2 example below is relative to 'pwd' resource.
####
# Enter the path for your changelog file.
changeLogFile=samplechangelog.h2.sql
changeLogFile=example-changelog.json

#### Enter the Target database 'url' information ####
liquibase.command.url=jdbc:h2:tcp://localhost:9090/mem:dev
Expand Down
@@ -0,0 +1,7 @@
(example-changeset-sql.txt)

--changeset dev:1
create table test1(
id int primary key,
name varchar(255)
);
Expand Up @@ -20,7 +20,7 @@
## The url H2 example below is relative to 'pwd' resource.
####
# Enter the path for your changelog file.
changeLogFile=sample.changelog.xml
changeLogFile=example-changelog.sql

#### Enter the Target database 'url' information ####
liquibase.command.url=jdbc:h2:tcp://localhost:9090/mem:dev
Expand Down
41 changes: 41 additions & 0 deletions liquibase-core/src/main/resources/liquibase/examples/start-h2
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

if [ -z "${LIQUIBASE_HOME}" ]; then
suryaaki2 marked this conversation as resolved.
Show resolved Hide resolved
#liquibase home is not set

LIQUIBASE_PATH="$(which liquibase)"

if [ -z "${LIQUIBASE_PATH}" ]; then
echo "Must set LIQUIBASE_HOME environment variable, or have liquibase in your PATH"
exit 1
fi

LIQUIBASE_HOME=$(dirname "$(which liquibase)")
fi

if [ -z "${JAVA_HOME}" ]; then
#JAVA_HOME not set, try to find a bundled version
if [ -d "${LIQUIBASE_HOME}/jre" ]; then
JAVA_HOME="$LIQUIBASE_HOME/jre"
elif [ -d "${LIQUIBASE_HOME}/.install4j/jre.bundle/Contents/Home" ]; then
JAVA_HOME="${LIQUIBASE_HOME}/.install4j/jre.bundle/Contents/Home"
fi
fi

if [ -z "${JAVA_HOME}" ]; then
JAVA_PATH="$(which java)"

if [ -z "${JAVA_PATH}" ]; then
echo "Cannot find java in your path. Install java or use the JAVA_HOME environment variable"

exit 1
fi
else
#Use path in JAVA_HOME
JAVA_PATH="${JAVA_HOME}/bin/java"
fi


# echo "${JAVA_PATH}" -cp "${LIQUIBASE_HOME}/lib/h2-1.4.200.jar:${LIQUIBASE_HOME}/liquibase.jar" liquibase.example.StartH2Main

"${JAVA_PATH}" -cp "${LIQUIBASE_HOME}/lib/h2-1.4.200.jar:${LIQUIBASE_HOME}/liquibase.jar" liquibase.example.StartH2Main
@@ -0,0 +1,34 @@
@echo off
if "%OS%" == "Windows_NT" setlocal

setlocal enabledelayedexpansion

rem %~dp0 is expanded pathname of the current script under NT
rem %~p0 is the directory of the current script

if exist %~p0\..\liquibase.jar SET LIQUIBASE_HOME="%~p0\.."

if "%LIQUIBASE_HOME%"=="" (
FOR /F "tokens=* USEBACKQ" %%g IN (`where liquibase.bat`) do (SET "LIQUIBASE_HOME=%%~dpg")
)

if "%LIQUIBASE_HOME%"=="" (
echo "Must set LIQUIBASE_HOME environment variable, or have liquibase.bat in your PATH"
exit /B 1
)

if "%JAVA_HOME%"=="" (

rem check for jre dir in liquibase_home
if NOT "%LIQUIBASE_HOME%"=="" if exist "%LIQUIBASE_HOME%\jre" (
set JAVA_HOME=%LIQUIBASE_HOME%\jre
)
)

if "%JAVA_HOME%"=="" (
set JAVA_PATH=java
) else (
set JAVA_PATH=%JAVA_HOME%\bin\java
)

"%JAVA_PATH%" -cp "%LIQUIBASE_HOME%\lib\h2-1.4.200.jar;%LIQUIBASE_HOME%\liquibase.jar" liquibase.example.StartH2Main
Expand Up @@ -8,11 +8,11 @@
http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.6.xsd ">

<changeSet id="1" author="author name">
<!--Insert XML changes objects here https://www.liquibase.org/documentation/xml_format.html-->
<!--Insert XML change objects here https://www.liquibase.org/documentation/xml_format.html-->
</changeSet>

<changeSet id="2" author="author name">
<!--Insert XML changes objects here https://www.liquibase.org/documentation/xml_format.html-->
<!--Insert XML change objects here https://www.liquibase.org/documentation/xml_format.html-->
</changeSet>

</databaseChangeLog>
@@ -0,0 +1,13 @@
<changeSet id="1" author="your.name">
<createTable tableName="person">
<column name="id" type="int">
<constraints primaryKey="true"/>
</column>
<column name="name" type="varchar(50)">
<constraints nullable="false"/>
</column>
<column name="address1" type="varchar(50)"/>
<column name="address2" type="varchar(50)"/>
<column name="city" type="varchar(30)"/>
</createTable>
</changeSet>