Summary
When adding a new Data Source with DB Schema Management = "Update Only" or "Create and Update" (on an already existing database), Jmix/Liquibase silently drops all database tables that are not mapped to any Jmix entity. This behavior is undocumented, potentially destructive, and can lead to data loss in production environments.
Additionally, the settings available to mitigate this behavior (exclude-prefixes) are not documented anywhere in the official Jmix documentation.
Environment
- Jmix (all versions using Liquibase-based schema management)
- IntelliJ IDEA with Jmix Studio plugin
Steps to Reproduce
The issue manifests in two scenarios:
Scenario A — Update Only
- Have an existing database with tables — some mapped to Jmix entities, some not (e.g., tables from a legacy system, external integrations, etc.)
- In Jmix Studio, add a new Additional Data Source
- Set DB Schema Management to
Update Only
- Run the application or apply the generated changelog
Scenario B — Create and Update on an existing database
- Have an existing database with tables not mapped to any Jmix entity
- In Jmix Studio, add a new Additional Data Source
- Set DB Schema Management to
Create and Update
- Run the application or apply the generated changelog
Actual Behavior
All tables not associated with any Jmix entity are dropped. Only standard Liquibase service tables remain:
DATABASECHANGELOG
DATABASECHANGELOGLOCK
Expected Behavior
- With
Update Only mode — Liquibase should only apply new changesets and leave unrelated tables untouched
- With
Create and Update mode on an existing database — Liquibase should create missing entity tables and leave unrelated tables untouched
Impact
This behavior is silently destructive. A developer who is unaware of it can permanently lose data in a production database without any warning or confirmation prompt.
Workaround (Currently Undocumented)
Two undocumented settings exist to exclude tables from Liquibase management by prefix:
1. Per-project: application.properties
# Replace 'main' with your DataStore name
main.datasource.studio.liquibase.exclude-prefixes=legacy_,ext_,custom_
This instructs Jmix Studio to skip tables with the specified prefixes when generating changelogs.
2. Global: IntelliJ IDEA Registry
Via Help → Find Action → Registry, set the key:
io.jmix.liquibase.excludePrefixes=legacy_,ext_,custom_
This applies globally across all Jmix projects in the IDE.
| Scope |
Key |
Effect |
| Per-project |
<store>.datasource.studio.liquibase.exclude-prefixes |
Affects specific DataStore only |
| Global (IDE) |
io.jmix.liquibase.excludePrefixes |
Applies to all projects in IDE |
What Should Be Documented
- The drop behavior itself — clearly explain that both
Update Only and Create and Update modes will remove tables not associated with Jmix entities when applied to an existing database
exclude-prefixes property — document both the application.properties key and the IDE Registry key, with examples
- A warning in the "Add Data Source" wizard or in the DB Schema Management documentation about the destructive nature of this behavior
- Limitation:
exclude-prefixes works only by prefix — tables without a common prefix cannot be excluded individually. This limitation should also be noted.
Suggested Documentation Location
Additional Notes
These settings were discovered empirically (by encountering data loss) and through source code inspection — not through official documentation. Given how destructive the default behavior is, proper documentation is critical for developer safety.
Summary
When adding a new Data Source with DB Schema Management = "Update Only" or "Create and Update" (on an already existing database), Jmix/Liquibase silently drops all database tables that are not mapped to any Jmix entity. This behavior is undocumented, potentially destructive, and can lead to data loss in production environments.
Additionally, the settings available to mitigate this behavior (
exclude-prefixes) are not documented anywhere in the official Jmix documentation.Environment
Steps to Reproduce
The issue manifests in two scenarios:
Scenario A —
Update OnlyUpdate OnlyScenario B —
Create and Updateon an existing databaseCreate and UpdateActual Behavior
All tables not associated with any Jmix entity are dropped. Only standard Liquibase service tables remain:
DATABASECHANGELOGDATABASECHANGELOGLOCKExpected Behavior
Update Onlymode — Liquibase should only apply new changesets and leave unrelated tables untouchedCreate and Updatemode on an existing database — Liquibase should create missing entity tables and leave unrelated tables untouchedImpact
This behavior is silently destructive. A developer who is unaware of it can permanently lose data in a production database without any warning or confirmation prompt.
Workaround (Currently Undocumented)
Two undocumented settings exist to exclude tables from Liquibase management by prefix:
1. Per-project:
application.propertiesThis instructs Jmix Studio to skip tables with the specified prefixes when generating changelogs.
2. Global: IntelliJ IDEA Registry
Via Help → Find Action → Registry, set the key:
This applies globally across all Jmix projects in the IDE.
<store>.datasource.studio.liquibase.exclude-prefixesio.jmix.liquibase.excludePrefixesWhat Should Be Documented
Update OnlyandCreate and Updatemodes will remove tables not associated with Jmix entities when applied to an existing databaseexclude-prefixesproperty — document both theapplication.propertieskey and the IDE Registry key, with examplesexclude-prefixesworks only by prefix — tables without a common prefix cannot be excluded individually. This limitation should also be noted.Suggested Documentation Location
Additional Notes
These settings were discovered empirically (by encountering data loss) and through source code inspection — not through official documentation. Given how destructive the default behavior is, proper documentation is critical for developer safety.