Full-stack dev quiz question #58

Full-stack dev quiz question #58quiz

Liquibase preconditions are more advanced elements of changeset. However, they may help when there are discrepancies between databases on different environments. Check fifty eighth question of full-stack dev quiz to check if you understand preconditions.

Below code is a Liquibase changeset, that will be applied to a database that already have test_table table by using an update command. Look at it and choose the sentences, that are true about it.

<changeSet id="Changeset 1" author="DBA presents">
<preConditions onFail="MARK_RAN">
<columnExists tableName="test_table" columnName="test" />
<addColumn tableName="test_table">
<column name="test" type="int" />

Choose all valid answers.

  1. It will add a test column to a table if the column does not exist, yet.
  2. If a test column already exists, the update operation will fail.
  3. It will try to apply addColumn change no matter if a test column exists or not.
  4. If a test column already exists, the update operation will succeed.
  5. After the database update, Changeset 1 will be marked as executed no matter if a test column existed or not.

For the correct answer scroll down













Do not miss valuable content. You will receive a monthly summary email. You can unsubscribe anytime.

















The correct answer is: a, d, e. If you would like to read more, check Add column if not exists with Liquibase article or more basic one about preconditions.

If you like what I do, consider buying me a coffee :)

Buy me a coffeeBuy me a coffee