skip to Main Content

I have some SQL scripts that I’d like to convert into Liquibase XML changelogs. Is this possible?

2

Answers


  1. What exactly do you mean by "convert into changelogs"?

    If you don’t need cross-database compatibility, you could just use the sql executor:

    <changeSet id="testing123" author="me">
      <sql splitStatements="false">
        <!-- all your existing SQL paste here -->
      </sql>
    </changeSet>
    

    The splitStatements=false setting will make sure the complete SQL will be sent in one command; otherwise, Liquibase would split it into multiple commands at semicolons.

    Login or Signup to reply.
  2. You could use a detour via a database. Apply your script to a database of choice (that is supported by liquibase). Then use generateChangeLog to generate the changelogs in xml from the database. You will have the XML changelog generated for all the SQL scripts you have applied to your database.

    Alternatively, have a look at answer on this SO post.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search