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

include tag in history tabular output (DAT-15244) #4805

Merged
merged 2 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,37 @@ Optional Args:
Liquibase History for jdbc:h2:mem:lbcat
""",
~/[-+]+/,
"| db/changelog/db.changelog-master.xml | nvoxland | 1 |",
"| db/changelog/sql/create_test2.sql | includeAll | raw |",
"| db/changelog/sql/create_test3.sql | includeAll | raw |",
"| db/changelog/changelog-x.xml | nathan (generated) | 1571079854679-2 |"]
"| db/changelog/db.changelog-master.xml | nvoxland | 1 | |",
"| db/changelog/sql/create_test2.sql | includeAll | raw | |",
"| db/changelog/sql/create_test3.sql | includeAll | raw | |",
"| db/changelog/changelog-x.xml | nathan (generated) | 1571079854679-2 | |"]

expectedResults = [
deployments: "1 past deployments",
statusCode : 0
]
}

run "Happy path with tag", {
arguments = [
url : { it.url },
username: { it.username },
password: { it.password }
]
setup {
runChangelog "changelogs/h2/complete/rollback.tag.changelog.xml"
}

expectedOutput = [
"""
Liquibase History for jdbc:h2:mem:lbcat
""",
~/[-+]+/,
"| changelogs/h2/complete/rollback.tag.changelog.xml | nvoxland | 1 | |",
"| changelogs/h2/complete/rollback.tag.changelog.xml | nvoxland | 1.1 | |",
"| changelogs/h2/complete/rollback.tag.changelog.xml | nvoxland | 2 | |",
"| changelogs/h2/complete/rollback.tag.changelog.xml | testuser | 13.1 | version_2.0 |",
"| changelogs/h2/complete/rollback.tag.changelog.xml | nvoxland | 14 | |"]

expectedResults = [
deployments: "1 past deployments",
Expand Down Expand Up @@ -121,10 +148,10 @@ Liquibase History for jdbc:h2:mem:lbcat
Liquibase History for jdbc:h2:mem:lbcat
""",
~/[-+]+/,
"| db/changelog/db.changelog-master.xml | nvoxland | 1 |",
"| db/changelog/sql/create_test2.sql | includeAll | raw |",
"| db/changelog/sql/create_test3.sql | includeAll | raw |",
"| db/changelog/changelog-x.xml | nathan (generated) | 1571079854679-2 |" ]
"| db/changelog/db.changelog-master.xml | nvoxland | 1 | |",
"| db/changelog/sql/create_test2.sql | includeAll | raw | |",
"| db/changelog/sql/create_test3.sql | includeAll | raw | |",
"| db/changelog/changelog-x.xml | nathan (generated) | 1571079854679-2 | |" ]
]

expectedResults = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ public static class TabularDeploymentDetails implements ReportPrinter {
"Update Date",
"Changelog Path",
"Changeset Author",
"Changeset ID");
"Changeset ID",
"Tag");

private final List<RanChangeSet> changeSets;
private final CommandScope commandScope;
Expand All @@ -217,7 +218,8 @@ public void printReport(PrintWriter output) throws LiquibaseException {
dateFormat.format(changeSet.getDateExecuted()),
changeSet.getChangeLog(),
changeSet.getAuthor(),
changeSet.getId()
changeSet.getId(),
changeSet.getTag() == null ? "" : changeSet.getTag()
)
)
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ class InternalHistoryCommandStepTest extends Specification {
StringUtil.standardizeLineEndings(output.trim()) == StringUtil.standardizeLineEndings("""
Liquibase History for jdbc:some://url

+-----------------+-------------+-----------------+------------------+---------------+
| Deployment ID | Update Date | Changelog Path | Changeset Author | Changeset ID |
+-----------------+-------------+-----------------+------------------+---------------+
| deployment-id-1 | 2022 | some/change/log | me | some/id |
+-----------------+-------------+-----------------+------------------+---------------+
| deployment-id-1 | 2022 | some/change/log | me | some/other/id |
+-----------------+-------------+-----------------+------------------+---------------+

+-----------------+-------------+-----------------+------------------+----------------+
| Deployment ID | Update Date | Changelog Path | Changeset Author | Changeset ID |
+-----------------+-------------+-----------------+------------------+----------------+
| deployment-id-2 | 2023 | some/change/log | me | yet/another/id |
+-----------------+-------------+-----------------+------------------+----------------+
+-----------------+-------------+-----------------+------------------+---------------+-----+
| Deployment ID | Update Date | Changelog Path | Changeset Author | Changeset ID | Tag |
+-----------------+-------------+-----------------+------------------+---------------+-----+
| deployment-id-1 | 2022 | some/change/log | me | some/id | |
+-----------------+-------------+-----------------+------------------+---------------+-----+
| deployment-id-1 | 2022 | some/change/log | me | some/other/id | |
+-----------------+-------------+-----------------+------------------+---------------+-----+

+-----------------+-------------+-----------------+------------------+----------------+-----+
| Deployment ID | Update Date | Changelog Path | Changeset Author | Changeset ID | Tag |
+-----------------+-------------+-----------------+------------------+----------------+-----+
| deployment-id-2 | 2023 | some/change/log | me | yet/another/id | |
+-----------------+-------------+-----------------+------------------+----------------+-----+

""".trim())

Expand Down