question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refactor LiquibaseCommand API

See original GitHub issue

Description

Currently, liquibase.Liquibase is the primary “porcelain” façade for working with Liquibase (https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain)). However, as Liquibase’s functionality has grown over the years, we have outgrown a single facade class.

A few years ago, we started the liquibase.command package as the replacement for the liquibase.Liquibase class and have been experimenting using it for a few commands. Now is the time to take what we have learned to finalize the design and apply it to all our existing commands.

Backwards Compatibility

Moving the code out of the liquibase.Liquibase facade methods will be a long term process, and should be backwards compatible, even as their implementations are replaced with calls to the new LiquibaseCommand classes.

Compatibility with the existing LiquibaseCommand classes specifically will be tracked in #1752

Requirements / Changes

NOTE: This section will evolve as we do the actual implementation and see the actual API changes in action. Follow along with the PR for the full details.

  • LiquibaseCommands can be grouped by zero or more nested parent names
  • LiquibaseCommand objects are pluggable by command group + name (e.g. liquibase hub registerChangelog) – in this example hub is a command group.
    • This is a new capability, however, it will only be testable when a future requirement is identified to create a new group.
  • LiquibaseCommands follow a “pipeline” structure, where they are additive in logic/arguments rather than replacing.
  • Add a CommandScope for managing a command including configuration and input/output
  • Logic to execute a command will be moved from LiquibaseCommand to CommandScope
  • LiquibaseCommand instances provide metadata of name, description, available parameters, required parameters, etc. which can be used to populate CLI etc. help.
  • LiquibaseCommand parameters are exposed as CommandArgumentDefinitions for type-safe get/set logic. Similar to the updated LiquibaseConfiguration style
  • Unconfigured LiquibaseCommand parameters will be set with values the LiquibaseConfiguration system as part of the execute() function

Acceptance Criteria

  • Ability to define commands with new APIs
  • API changes are reviewed and support what we need in the short-term and should not need breaking changes in the future
  • API is well javadoc documented and unit tested
  • Existing CLI/Maven/etc. user functionality works as before

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nvoxlandcommented, Mar 4, 2021

We had an internal code review meeting to discuss the changes #1708 and we were happy with that direction.

The “hook”/pipeline style turned out to not add unneeded complexity, keeps the programmatic interactions cleaner/safer, and allows for some useful functionality such as cross-cutting logic.

I’ll update the description of this ticket to not have questions on the pipeline vs. replace, and the next steps wrapping up of #1708 and then moving on to converting code to use it.

0reactions
sync-by-unito[bot]commented, May 3, 2021

➤ Erzsebet Carmean commented:

Not flagged for UAT; moving to ready to merge.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with Command Parameters | Liquibase Docs
This page explains how to run liquibase from the command line. You can also get specific information about the liquibase.properties files.
Read more >
Database Migration and Refactoring with LiquiBase - InfoQ
LiquiBase can perform database migrations as part of a build with Ant support and a nascent Maven plugin, or as part of your...
Read more >
Use Liquibase to Safely Evolve Your Database Schema
In this article, we illustrated several ways to use Liquibase and get to a safe and mature way of evolving and refactoring the...
Read more >
Database Refactoring with Liquibase
There are two basic commands in Liquibase to execute refactorings. The “update” command applies all outstanding changesets within the associated ...
Read more >
Tool-based Database Refactoring: Flyway vs. Liquibase
These commands can be executed from the command line, from a build process (e.g. with Maven or Gradle) or directly from Java code,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found