How to deploy and run liquibase?

Asked

Viewed 819 times

2

How do I deploy liquibase? and run it? I have java projects and use oracle database.

This tool has the possibility to generate from the version file of the state of the database, you can generate in . SQL??

You can use this file to go back to an old version of the database?

I await return thank you.

1 answer

2

There are several ways to use Liquibase in your projects. It is possible to use the command line to generate, XML from an SQL and vice versa, there are other formats such as YAML, JSON, among others. In addition to the command line, there is also a maven plugin to run during the project build. And also has ICD support which enables direct execution on the application deploy on the server.

Below is an example of the most common way of using Liquibase for DB versioning.

   <changeSet author="nome-author" id="meu-changeset-id-1">
        <createTable tableName="user">
            <column name="uuid" type="VARCHAR(255)">
                <constraints primaryKey="true" />
            </column>
            <column name="name" type="VARCHAR(255)">
                <constraints nullable="false" />
            </column>
            <column name="age" type="INT" />
        </createTable>
    </changeSet>

All other changes to the database table are only added to a new "changeset", making it possible to make roolback at any time.

Note that it is not a tool to generate/ translate queries. Liquibase is a powerful versioning framework.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.