Multi-Store Liquibase Configuration Running on Wrong Datasource

Problem Description

Jmix Version: 1.7.1

We have a multi-store configuration where:

  • Main store uses schema: digital_modularization_primary
  • Additional store (digital) uses schema: digital_addon

Expected Behavior:

  • Liquibase scripts from the addon should ONLY run on the digital datasource (schema: digital_addon )
  • Main project Liquibase should ONLY run on the main datasource (schema: digital_modularization_primary )

Actual Behavior:

  • Addon Liquibase scripts are running on BOTH datasources
  • Scripts execute on both digital_addon AND digital_modularization_primary schemas

Configuration

Addon module.properties:
digital.datasource.jdbc-url=jdbc:postgresql://1.1.1.1:9876/Dev?currentSchema=digital_addon
jmix.core.additional-stores=digital
jmix.data.stores = digital
digital.liquibase.enabled=true
jmix.liquibase.store-enabled.digital=false # Attempted to disable

Addon Configuration Class:
@Bean
@ConditionalOnProperty(name = “digital.liquibase.enabled”, havingValue = “true”)
public SpringLiquibase digitalLiquibase(
@Qualifier(“digitalDataSource”) DataSource dataSource) {
SpringLiquibase liquibase = new SpringLiquibase();
liquibase.setDataSource(dataSource);
liquibase.setChangeLog(“classpath:/com/mcollect/digital/liquibase/changelog.xml”);
liquibase.setContexts(“digital”);
return liquibase;
}

Expected Solution

We need a clear way to:

  • Disable automatic Liquibase for specific stores while keeping it enabled for others
  • Ensure addon Liquibase scripts run exclusively on their configured datasource
  • Prevent cross-store Liquibase execution without complex workarounds

Вот ответ:


Hi Puneet,

The issue is that Jmix automatically runs Liquibase for all registered stores, including digital, so your custom SpringLiquibase bean ends up running it a second time on top of that.

Also, jmix.liquibase.store-enabled.digital=false is not a valid property — it won’t have any effect.

Option 1 (recommended): remove the custom bean entirely

Jmix already handles Liquibase for the digital store automatically. Just make sure the changelog path is configured correctly in application.properties:

digital.liquibase.change-log = com/mcollect/digital/liquibase/changelog.xml

That’s all you need — no custom SpringLiquibase bean required.

Option 2: manage Liquibase manually via your custom bean

If you need custom Liquibase setup, disable the automatic one for the digital store using the correct property:

digital.liquibase.enabled=false

Then your @ConditionalOnProperty bean will be the only one running migration for digital_addon.

One more thing to check

Make sure the addon changelog is NOT included in the main store’s root changelog.xml via an <include> directive.

Docs: