I am trying to start using liquibase on an existing SQL Server database. As a starting point I would like to use liquibase to generate the existing schema with the generateChangeLog command. This is what I am doing:
./liquibase --logLevel=debug --password=“myPassword” --username=myuser --url=“jdbc:sqlserver://localhost:1433;databaseName=My_Database_1” --changeLogFile=mylog.mssql.sql --includeTablespace=true --includeSchema=true --includeCatalog=true --schemas=My_Database_1 --defaultCatalogName=My_Database_1 --defaultSchemaName=My_Database_1 generateChangeLog
If I were using plain SQL I would have a statement near the top saying
The ‘myuser’ user’s default schema is not My_Database_1. I’m not sure what the ‘schema’ command in liquibase is doing: SQL Server has multiple databases as well as schemas, and I need to generate a changelog for more than one database within the same server instance.
Liquibase gives me:
[2020-08-20 11:46:30] SEVERE [liquibase.integration] Unexpected error running Liquibase: Cannot use default schema name My_Database_1 on Microsoft SQL Server because the login schema of the current user (dbo) is different and MSSQL does not support setting the default schema per session.
Is there any way to use Liquibase to generate an initial changelog with SQL Server which is running more than one database?