JDBC URL Command line with database and set default schema

Help -

Hi Team,
Could you please help us me to understand how to pass the JDBC URL from command line with database?

I am trying to have dynamic url. Is it possible to have multiple environment wise liquibase.properties. files?

Also, how to set default schema in properties file or using command prompt? I need to remove the table_schema from below query/

–preconditions onFail:MARK_RAN onError:HALT
–precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM information_schema.tables WHERE table_name = ‘configuration’ AND table_schema = ‘flywaymigration’;

Hi @Asmita,

There are few ways to work the a dynamic URL.

  1. You could use the --url command line parameter. See docs here → https://docs.liquibase.com/parameters/home.html
  2. You set the URL as an environment variable. See docs here → https://docs.liquibase.com/concepts/connections/liquibase-environment-variables.html
  3. You could have per-environment liquibase properties files, e.g. liquibase.dev.properties and liquibase.ci.properties and liquibase.prod.properties

For the second part of your question:

You can use changelog properties to substitute text in your changelog, such as the table_schema.
You can manually set up any properties you want, but Liquibase also creates a property named ${database.defaultSchemaName} that you can reference.

For example:
–precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM information_schema.tables WHERE table_name = ‘configuration’ AND table_schema = ‘${database.defaultSchemaName}’;

I hope that helps.

-PJ