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 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 Disabled Hibernate auto schema updates spring : jpa : hibernate : ddl-auto : none From that moment, Hibernate stopped modifying the database structure . 2. Enabled Liquibase spring : liquibase : enabled : true change-log : classpath:db/changelog/changelog.xml 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)" >
Continue reading on Dev.to Webdev
Opens in a new tab




