Reputation: 155
When writing a changeSet for creating a table, you can specify the table's schema (see here)
If I run
liquibase generateChangeLog
The output doesn't include a schema.
For reference, here's the liquibase.properties file I'm using:
driver: org.h2.Driver
classpath: h2-1.4.181.jar
url: jdbc:h2:~/test.db
username: sa
password: sa
changeLogFile: baseline.xml
liquibaseCatalogName: LIQUIBASE
liquibaseSchemaName: BAR
defaultSchemaName: BAR
outputDefaultSchema: true
outputDefaultCatalog: true
The output for one of the tables:
<createTable tableName="PRODUCTS">
<column name="ID" type="INT(10)"/>
<column name="CODE" type="VARCHAR(10)"/>
<column name="PRICE" type="DECIMAL(9, 2)"/>
</createTable>
If I were to write this manually, I would include the schema:
<createTable schemaName="BAR" tableName="PRODUCTS">
<column name="ID" type="INT(10)"/>
<column name="CODE" type="VARCHAR(10)"/>
<column name="PRICE" type="DECIMAL(9, 2)"/>
</createTable>
Is this by design? I'm OK with using an XSLT after the fact.
Upvotes: 3
Views: 6268
Reputation: 1599
Please use outputDefaultSchema=true
. This will output the schema name in the changeset.
When using the maven plugin, please use <outputDefaultSchema>true</outputDefaultSchema>
Upvotes: 1
Reputation: 15763
Use the --includeCatalog=true
flag after generateChangeLog. For example: liquibase generateChangeLog --includeCatalog=true
The outputDefaultSchema is only used if generateChangeLog should be including schema information in the first place.
Upvotes: 3