Skip to content

Demo showing multi-schema does not work with Liquibase SQL change sets

Notifications You must be signed in to change notification settings

CynanX/LiquibaseMultiSchemaIssue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LiquibaseMultiSchemaIssue

Demo showing multi-schema does not work with Liquibase SQL change sets.

Getting started

In order to run this example you will need a local MySQL database running.

You must then create new databases demoDbA and demoDbB. demoDb will be auto-created as the default database.

Expected behaviour

The changelog included should create a new persons table in each of the three databases.

Acutal behvaiour

The table will be created in the default database, but error on the second. The third will not be touched.

022-09-04 18:29:52.196  WARN 26507 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'multiTenantSpringLiquibase' defined in class path resource [uk/co/mark/liquibase/demo/LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set changelog/1.0.0/tables/create_persons_table.xml::createPersonsTable::mark:
     Reason: liquibase.exception.DatabaseException: Table 'persons' already exists [Failed SQL: (1050) CREATE TABLE persons
            (
                personId  int,
                lastName  varchar(255),
                firstName varchar(255),
                address   varchar(255),
                city      varchar(255)
            );]

It appears that when a changeset contains a pure SQL instruction the default schema is always used in error.

About

Demo showing multi-schema does not work with Liquibase SQL change sets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages