DEV Community

Marcin Parśniak
Marcin Parśniak

Posted on

Moving from Hibernate Auto-DDL to Liquibase - Finovara

Hello!

For a long time in my Spring Boot project, I relied on

hibernate.ddl-auto = update
Enter fullscreen mode Exit fullscreen mode

It was simple.
Change an entity → restart the app → the database updates itself.

But when the project grew to 18 entities, I realized something important:

I had zero control over my database history.

So I decided to switch to Liquibase.

What I Changed

  1. Disabled Hibernate auto schema updates
spring:
  jpa:
    hibernate:
      ddl-auto: none

Enter fullscreen mode Exit fullscreen mode

From that moment, Hibernate stopped modifying the database structure.

2. Enabled Liquibase

spring:
  liquibase:
    enabled: true
    change-log: classpath:db/changelog/changelog.xml
Enter fullscreen mode Exit fullscreen mode

3. Added simple changeSets

<changeSet id="1-create-users" author="Marcin Parśniak">
        <createTable tableName="users">
            <column name="id" type="BIGINT" autoIncrement="true">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="username" type="VARCHAR(255)">
                <constraints nullable="false" unique="true"/>
            </column>
            <column name="password" type="VARCHAR(255)">
                <constraints nullable="false"/>
            </column>
            <column name="email" type="VARCHAR(255)">
                <constraints nullable="false" unique="true"/>
            </column>
            <column name="created_at" type="TIMESTAMP"/>
            <column name="profile_image_path" type="VARCHAR(500)"/>
        </createTable>
    </changeSet>
Enter fullscreen mode Exit fullscreen mode

Now Liquibase manages the schema.

If you want to see how im doing it, check out my github profile:

GitHub logo M4rc1nek / finovara-backend

Backend service for a personal finance management application

Finovara

Backend platform for a personal finance management application, built with Java 25 and Spring Boot 4 as a set of microservices.

About the Project

Finovara is a personal finance platform designed to help users take full control of their money. The backend exposes a secure REST API that powers tracking of income and expenses, budget management, savings goals, shared accounts and financial reporting.

The platform is built as a set of independent services, each responsible for a separate area of the domain, so that individual parts of the system can be developed, deployed and scaled on their own. Security is a central concern: authentication is based on JWT, sessions are tracked per device, and user activity is recorded in an audit log.


Key Features

Accounts and Security

  • Authentication and Authorization - stateless JWT security built on Spring Security, with an access and refresh token flow.
  • Device and Session Tracking…




Top comments (0)