PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, April 14, 2022

[FIXED] How to make preConditions for two columns in liquibase?

 April 14, 2022     liquibase, migration, sql     No comments   

Issue

I don't know how to check two columns in table migration. I use liquibase. I wanna to make something like this:

        "preConditions": [
      {
        "onFail": "MARK_RAN",
        "not": {
          "columnExists": {
            "columnName": "first_column",
            "tableName": "my_table"
          },
          "columnExists": {
            "columnName": "second_column",
            "tableName": "my_table"
          }
        }
      }
    ]

Solution

not is supposed to be an array of objects. It may add additional logic by using an “and” (default value) or “or” operators.

I’d go with the following:

 "preConditions": [{
    "onFail": "MARK_RAN",
    "not": [{
        "and": [{
            "columnExists": {
                "columnName": "first_column",
                "tableName": "my_table"
            }
        }, {
            "columnExists": {
                "columnName": "second_column",
                "tableName": "my_table"
            }
        }]
    }]
}]


Answered By - htshame
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing