I *really* need changesets to INCLUDE schemas

We are starting to use liquibase in our development (because we are starting to use jhipster and it uses liquibase). We have existing databases that we have to work with on an oracle database. I am very dismayed to find that apparently there is no way, that actually works anymore with liquibase 4.4.3, to have generateChangeLog INCLUDE the schema names of the tables (yet it always includes the table space name, something I have NEVER had to specify when creating tables in 30 years).

I have tried including the --includeCatalog=true --includeSchema=true --outputDefaultSchema=true --outputDefaultCatalog=true --includeTableSpace=false paramters on the command line as well as including the following line in liquibase.properties:

includeCatalog: true
includeSchema: true
outputDefaultSchema: true
outputDefaultCatalog: true
includeTableSpace: false

How is it that this is no longer possible, or was it ever possible?
googling seemed to indicate that using those parameters should work.

also why on earth would those default to false? that is not reasonable with most databases.

Hi @naris

Could you please try using below properties once:

-–includeSchema=true 
-–schemas=schema_name1,schame_name2

This will result into a changelogfile with changesets specifying the schema names, when I tried it on my end I got changeset populated inside output file as below:

<changeSet author="rakhi_agrawal1 (generated)" id="1630040033882-4">
        <createTable schemaName="schema_name1" tableName="user_roles">
            <column name="role" type="VARCHAR(100)">
                <constraints nullable="false" primaryKey="true" primaryKeyName="constraint_c6c7"/>
            </column>
            <column name="uid" type="VARCHAR(100)">
                <constraints nullable="false" primaryKey="true" primaryKeyName="constraint_c6c7"/>
            </column>
        </createTable>
    </changeSet>
<changeSet author="rakhi_agrawal1 (generated)" id="1630040033882-5">
        <createTable schemaName="schema_name2" tableName="user_roles2">
            <column name="role" type="VARCHAR(100)">
                <constraints nullable="false" primaryKey="true" primaryKeyName="constraint_c6c7"/>
            </column>
            <column name="uid" type="VARCHAR(100)">
                <constraints nullable="false" primaryKey="true" primaryKeyName="constraint_c6c7"/>
            </column>
        </createTable>
    </changeSet>

FYI, the complete command I executed was like below:
liquibase --changelogFile=gen_out.xml --includeSchema=true --schemas=schema_name1,schame_name2 generateChangelog

Please give this a try and let us know the results.

Thanks,
Rakhi Agrawal

I already tried that, it does not include the schemeName. However, it always includes the tablespace :confused:

liquibase --defaults-file=liquibase.properties --schemas=GREF,SDD,SDDE --changelog-file changelog/00000000000002_existing_schema.xml --includeSchema=true generateChangeLog
    <changeSet author="murwilso (generated)" id="1630071050408-2">
        <createTable tableName="GREF_ANSWERS" tablespace="GREF_TBS01">
            <column name="ANSWER_ID" type="NUMBER(10, 0)">
                <constraints nullable="false" primaryKey="true" primaryKeyName="GREF_ANS_PK"/>
            </column>
            <column name="QUESTION_ID" type="NUMBER(10, 0)">
                <constraints nullable="false"/>
            </column>
            <column name="METADATA_STATUS_LCD" type="NUMBER(5, 0)"/>
            <column name="CDN_US_DISPLAY_LCD" type="NUMBER(5, 0)"/>
            <column name="CDN_SENSITIVITY_LCD" type="NUMBER(5, 0)"/>
            <column name="USA_SENSITIVITY_LCD" type="NUMBER(5, 0)"/>
            <column name="ANSWER_POS_NO" type="NUMBER(10, 0)"/>
            <column name="ANSWER_SOURCE_LCD" type="NUMBER(5, 0)"/>
            <column name="ANSWER_TYPE_LCD" type="NUMBER(5, 0)"/>
            <column name="SEQ_NO" type="NUMBER(10, 0)"/>
            <column name="QUERYABLE_FLG" type="CHAR(1 BYTE)"/>
            <column name="TEMPLATABLE_FLG" type="CHAR(1 BYTE)"/>
            <column name="UPDT_DT" type="date"/>
            <column name="UPDT_QUESTIONER_ID" type="NUMBER(10, 0)"/>
            <column name="TEMPLATE_DEFLEN_QTY" type="NUMBER(10, 0)"/>
            <column name="ALT_TABLE_NM" type="VARCHAR2(50 BYTE)"/>
            <column name="ALT_COL_NM" type="VARCHAR2(50 BYTE)"/>
            <column name="ALT_VALUE_STR" type="VARCHAR2(50 BYTE)"/>
            <column name="TEMPLATE_FIELD_DESC" type="VARCHAR2(255 BYTE)"/>
            <column name="ANSWER_NM" type="VARCHAR2(100 BYTE)"/>
            <column name="ANSWER_NOTE_STR" type="VARCHAR2(255 BYTE)"/>
            <column defaultValueNumeric="0" name="RELATED_ANSWER_ID" type="NUMBER(10, 0)"/>
            <column defaultValueNumeric="1" name="RESOLVE_TO_LCD" type="NUMBER(5, 0)"/>
        </createTable>
    </changeSet>
    <changeSet author="murwilso (generated)" id="1630071050408-3">
        <createTable tableName="GREF_ANSWER_DATES" tablespace="GREF_TBS01">
            <column name="ANSWER_DATE_ID" type="NUMBER(10, 0)">
                <constraints nullable="false" primaryKey="true" primaryKeyName="GREF_AD_PK"/>
            </column>
            <column name="ANSWER_DT" type="date">
                <constraints nullable="false"/>
            </column>
            <column name="HOLIDAY_FLG" type="CHAR(1 BYTE)"/>
            <column name="WEEKDAY_FLG" type="CHAR(1 BYTE)"/>
            <column name="LAST_DATE_IN_MONTH_FLG" type="CHAR(1 BYTE)"/>
            <column name="CALENDAR_YEAR_NO" type="NUMBER(10, 0)"/>
            <column name="JULIAN_DAY_NO" type="NUMBER(10, 0)"/>
            <column name="DAY_OF_WEEK_LCD" type="NUMBER(5, 0)"/>
            <column name="YEAR_OF_WEEK_NO" type="NUMBER(10, 0)"/>
            <column name="WEEK_OF_YEAR_NO" type="NUMBER(10, 0)"/>
            <column name="FISCAL_YEAR_NO" type="NUMBER(10, 0)"/>
        </createTable>
    </changeSet>
    <changeSet author="murwilso (generated)" id="1630071050408-4">
        <createTable tableName="GREF_CATEGORIES" tablespace="GREF_TBS01">
            <column name="CATEGORY_ID" type="NUMBER(10, 0)">
                <constraints nullable="false" primaryKey="true" primaryKeyName="GREF_CAT_PK"/>
            </column>
            <column name="PARENT_CATEGORY_ID" type="NUMBER(10, 0)"/>
            <column name="METADATA_STATUS_LCD" type="NUMBER(5, 0)"/>
            <column name="SEQ_NO" type="NUMBER(10, 0)"/>
            <column name="UPDT_DT" type="date"/>
            <column name="UPDT_QUESTIONER_ID" type="NUMBER(10, 0)"/>
            <column name="CATEGORY_NM" type="VARCHAR2(50 BYTE)"/>
        </createTable>
    </changeSet>

I think the problem might be that, for some reason, there are global synonyms for all the tables. An old DBA apparently thought that was a good idea :confused:

@naris Try again with v4.6.1 which is currently the latest version. We found an issue with regards to schemas being included.

1 Like