Repository navigation
feat: migrate DB migrations from Hibernate ddl-auto to Liquibase - #6
Merged
Merged
Conversation
- Add liquibase-core dependency to pom.xml - Create db.changelog-master.xml with changelog master file - Create 001-initial-schema.xml with all 13 tables + 7 join tables + indexes - Set spring.jpa.hibernate.ddl-auto=validate (Liquibase manages schema) - Configure spring.liquibase.change-log and enabled properties - Update .env.example with Liquibase comment Schema includes: app_user, app_group, app_privilege, menu_item, category, allergen, language, translation, app_order, order_items, order_item_quantity, app_table, service, plus all M:N join tables and foreign keys.
There was a problem hiding this comment.
Pull request overview
This PR migrates the backend database schema management from Hibernate ddl-auto=update to Liquibase, so schema creation/evolution is driven by versioned changelogs while Hibernate switches to ddl-auto=validate.
Changes:
- Added Liquibase dependency and enabled Liquibase on startup via Spring Boot properties.
- Introduced a Liquibase master changelog and an initial schema changelog covering core domain tables + order/service tables and indexes.
- Updated
.env.examplewith an (optional) Liquibase contexts hint.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/backend/src/main/resources/db/changelog/db.changelog-master.xml | Adds the Liquibase master changelog and includes the initial schema changelog. |
| packages/backend/src/main/resources/db/changelog/001-initial-schema.xml | Defines initial DB schema (tables, FKs, join tables) plus indexes. |
| packages/backend/src/main/resources/application.properties | Switches Hibernate to validate and configures Liquibase changelog execution. |
| packages/backend/pom.xml | Adds liquibase-core dependency (Spring Boot managed version). |
| .env.example | Documents optional Liquibase contexts env var. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog | ||
| http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.27.xsd"> | ||
|
|
||
| <include file="db/changelog/001-initial-schema.xml"/> |
Comment on lines
+13
to
+14
| spring.liquibase.change-log=classpath:db/changelog/db.changelog-master.xml | ||
| spring.liquibase.enabled=true |
Comment on lines
+8
to
+10
| <changeSet id="001-base-tables" author="table2taste"> | ||
| <comment>Core tables: language, translation, privilege, user, group, table, allergen, category, menu_item</comment> | ||
|
|
Comment on lines
+268
to
+276
| <createTable tableName="service"> | ||
| <column name="id" type="BIGINT" autoIncrement="true"> | ||
| <constraints primaryKey="true" nullable="false"/> | ||
| </column> | ||
| <column name="table_id" type="BIGINT"/> | ||
| <column name="open_timestamp" type="TIMESTAMP"/> | ||
| <column name="close_timestamp" type="TIMESTAMP"/> | ||
| <column name="is_open" type="BOOLEAN" defaultValueBoolean="true"/> | ||
| </createTable> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Descripcion
Migracion del esquema de base de datos de Hibernate
ddl-auto=updatea Liquibase.Cambios
pom.xmlliquibase-coreapplication.propertiesddl-auto=validate+ config Liquibasedb/changelog/db.changelog-master.xmldb/changelog/001-initial-schema.xml.env.exampleSchema Liquibase (13 tablas + 7 join tables)
CambioSet 001 — Tablas base:
language,translation,app_privilege,app_user,app_groupuser_group,group_privilege,group_translationallergen, join:allergen_translationcategory(self-referencing FK), join:category_translationmenu_item, joins:menu_item_translation,menu_item_allergenCambioSet 002 — Ordenes y servicios:
app_table,service,app_order,order_items,order_item_quantityapp_table.last_service → service.idCambioSet 003 — Indices:
idx_service_table_id,idx_app_order_service_id,idx_oiq_order_idComportamiento
spring.jpa.hibernate.ddl-auto=validate— Hibernate solo valida que las entidades coincidan con la BDDataLoader.javadesdedefaultData.json