Create your changelog-master.xml and changelog-v1.0.xml file in directory directory pointed from application.yml
changelog-master.xml should look like like:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLogxmlns="http://www.liquibase.org/xml/ns/dbchangelog"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<includefile="db/changelog/changelog-v1.0.xml"/>
</databaseChangeLog>
changelog-v1.0.xml should look like like this:
This is where you will define your create your schema for your database:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLogxmlns="http://www.liquibase.org/xml/ns/dbchangelog"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<!-- If we want to add new column to database use this below --><!-- <changeSet id="1" author="leron">--><!-- <addColumn schemaName="liquibase_demo" tableName="person">--><!-- <column name="address" type="varchar(255)"></column>--><!-- </addColumn>--><!-- <addColumn schemaName="liquibase-demo" tableName="person">--><!-- <column name="phone_number" type="varchar(255)"></column>--><!-- </addColumn>--><!-- </changeSet>--><!-- Creating the table with liquibase instead of hibernate-->
<changeSetid="20230726_person_table"author="leron">
<sql>
create sequence if not exists liquibase_demo.person_sequence_generator start 1 increment 1;
create table if not exists liquibase_demo.person (
id bigint not null,
name varchar(255),
address varchar(255),
phone_number varchar(255),
primary key (id)
);
</sql>
</changeSet>
<changeSetid="renamecolumn-name"author="leron">
<renameColumnschemaName="liquibase_demo"tableName="person"newColumnName="first_name"oldColumnName="name"columnDataType="varchar(255)"remarks="A change in names"/>
</changeSet>
<changeSetid="dropcolumn-name"author="leron">
<dropColumnschemaName="liquibase_demo"tableName="person"columnName="name"/>
</changeSet>
</databaseChangeLog>