Schema names in Sql Server

I’ve been looking at the documentation and trying anything I could find in the forum messages with no success so far. I’m looking to generate a single changeset from an existing local Sql Server database with multiple schemas.

Currently my command line is as follows:
liquibase --changeLogFile=myChangelog.xml --schemas=reference,config,logging,mapping,staging --include-schema=true generateChangeLog

Starting Liquibase at 15:51:30 (version 4.5.0 #52 built at 2021-09-27 16:19+0000)
Liquibase Version: 4.5.0
Liquibase Community 4.5.0 by Datical
BEST PRACTICE: The changelog generated by diffChangeLog/generateChangeLog should be inspected for correctness and completeness before being deployed.
Generated changelog written to /home/gdh/dev/Onyx/SAFHIR/src/data/databases/metadata/liquibase/myChangelog.xml
Output saved to /home/gdh/dev/Onyx/SAFHIR/src/data/databases/metadata/liquibase/output.sql
Liquibase command ‘generateChangelog’ was executed successfully.

However the generated content in myChangelog.xml does not contain any schema names:

<changeSet author="gdh (generated)" id="1635277893161-1">
    <createTable tableName="ADFConfig">
        <column autoIncrement="true" computed="false" name="ADFConfigID" type="int">
            <constraints nullable="false" primaryKey="true" primaryKeyName="PK_ADFConfig"/>
        </column>

Can someone help please with the correct command line to generate including the schema names?

Thank You,

Greg

I’m trying to do exactly the same. Did you have any luck?

Edit: Never mind, just saw your other thread. Went back to v4.3.5.

There was a bug that was fixed in v4.6.1. include-schemas should work again.

Thanks @MikeOlivas , 4.6.1 does indeed include schema names again. Now however I seem to be running into a permissions error from Liquibase. This is strange because if I run the same command thats failing from SQLCMD or within MSSMS as the same SA user it works fine:

> [2021-11-17 02:49:28] SEVERE [liquibase.integration] The specified schema name "config" either does not exist or you do not have permission to use it. [Failed SQL: (2760) CREATE TABLE config.ADFConfig (ADFConfigID int IDENTITY (1, 1) NOT NULL, ConfigName varchar(500) NOT NULL, ConfigActive char(1) NOT NULL, ConfigGrouping varchar(100) NOT NULL, CONSTRAINT PK_ADFConfig PRIMARY KEY (ADFConfigID))]
> liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: Unexpected error running Liquibase: Migration failed for change set fred.xml::1637055405311-1::gdh (generated):
>      Reason: liquibase.exception.DatabaseException: The specified schema name "config" either does not exist or you do not have permission to use it. [Failed SQL: (2760) CREATE TABLE config.ADFConfig (ADFConfigID int IDENTITY (1, 1) NOT NULL, ConfigName varchar(500) NOT NULL, ConfigActive char(1) NOT NULL, ConfigGrouping varchar(100) NOT NULL, CONSTRAINT PK_ADFConfig PRIMARY KEY (ADFConfigID))]
>         at liquibase.command.CommandScope.execute(CommandScope.java:156)
>         at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:45)
>         at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:15)
>         at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
>         at picocli.CommandLine.access$1300(CommandLine.java:145)
>         at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
>         at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
>         at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
>         at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
>         at picocli.CommandLine.execute(CommandLine.java:2078)
>         at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$1(LiquibaseCommandLine.java:325)
>         at liquibase.Scope.child(Scope.java:186)
>         at liquibase.Scope.child(Scope.java:162)
>         at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:291)
>         at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:80)