I am trying yo use the diff tool in order to compare my current DB state to a snapshot I created.
I am using liquibase version 4.3.0 #16 built on windows.
My database is on a remote (linux) server.
I do not have a database named “postgres”, instead I have a database with a different name, and multiple schemas.
The databasechangelog and databasechangeloglock tables are under a schema called “common”.
I used this sequnce of actions:
create the snapshot using this command: #liquibase “–url=jdbc:postgresql://10.7.7.15:2020/octdb” --defaultSchemaName=common snapshot > snapshots\snapshot1502145.json
– I can see the snapshot is created, with all the DB objects.
Prepare a new table script using the file dbchangelog.xml.
Generate it using the command: #liquibase --defaultSchemaName=common update
–Checked both DB and table databasechangelog to make sure the table was indeed created.
Test the diff using the command: #liquibase “–url=jdbc:postgresql://10.7.7.15:2020/octopusdb” --username=octopusrepmgr --password=mypassword --defaultSchemaName=common diff “–referenceUrl=offline:postgresql=snapshots\snapshot1502145.json” --diffTypes=tables
However, instead of just getting a report on the one table I created, I get a list of all the tables under this schema as “unexpected”:
Liquibase Community 4.3.0 by Datical
####################################################
Following the format of the mysql example from snapshot command | Liquibase Docs, I think your reference url should be –referenceUrl=offline:postgresql?snapshot=snapshots\snapshot1502145.json
Starting Liquibase at 09:43:03 (version 4.3.0 #16 built at 2021-02-09 15:47+0000)
Unexpected error running Liquibase: Cannot parse snapshot offline:postgresql?snapshot=snapshots\snapshot1702145.json
For more information, please use the --logLevel flag
running it in debud mode shows this on the referenceurl parameter:
[2021-02-21 09:44:01] FINE [liquibase.executor] Executing with the ‘jdbc’ executor
[2021-02-21 09:44:01] FINE [liquibase.executor] 0 row(s) affected
Unexpected error running Liquibase: Cannot parse snapshot offline:postgresql?snapshot=snapshots\snapshot1702145.json
For more information, please use the --logLevel flag
[2021-02-21 09:44:01] SEVERE [liquibase.integration] Unexpected error running Liquibase: Cannot parse snapshot offline:postgresql?snapshot=snapshots\snapshot1702145.json
liquibase.exception.DatabaseException: liquibase.exception.UnexpectedLiquibaseException: Cannot parse snapshot offline:postgresql?snapshot=snapshots\snapshot1702145.json
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:131)
at liquibase.integration.commandline.Main.createReferenceDatabaseFromCommandParams(Main.java:2050)
at liquibase.integration.commandline.Main.doMigration(Main.java:1484)
at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:364)
at liquibase.Scope.lambda$child$0(Scope.java:160)
at liquibase.Scope.child(Scope.java:169)
at liquibase.Scope.child(Scope.java:159)
at liquibase.Scope.child(Scope.java:138)
at liquibase.integration.commandline.Main$1.run(Main.java:363)
at liquibase.integration.commandline.Main$1.run(Main.java:193)
at liquibase.Scope.child(Scope.java:169)
at liquibase.Scope.child(Scope.java:145)
at liquibase.integration.commandline.Main.run(Main.java:193)
at liquibase.integration.commandline.Main.main(Main.java:156)
Caused by: liquibase.exception.UnexpectedLiquibaseException: Cannot parse snapshot offline:postgresql?snapshot=snapshots\snapshot1702145.json
at liquibase.database.OfflineConnection.(OfflineConnection.java:111)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:186)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:175)
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:140)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:96)
… 13 more
Caused by: liquibase.exception.LiquibaseParseException: Syntax error in json: expected ‘’, but found ‘’
in ‘reader’, line 18, column 1:
Starting Liquibase at 14:43:48 ( …
^
at liquibase.parser.core.yaml.YamlSnapshotParser.getParsedYamlFromInputStream(YamlSnapshotParser.java:75)
at liquibase.parser.core.yaml.YamlSnapshotParser.parse(YamlSnapshotParser.java:34)
at liquibase.database.OfflineConnection.<init>(OfflineConnection.java:101)
... 17 more
Caused by: expected ‘’, but found ‘’
in ‘reader’, line 18, column 1:
Starting Liquibase at 14:43:48 ( …
^
at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentStart.produce(ParserImpl.java:225)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148)
at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:122)
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:150)
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:490)
at org.yaml.snakeyaml.Yaml.load(Yaml.java:442)
at liquibase.parser.core.yaml.YamlSnapshotParser.getParsedYamlFromInputStream(YamlSnapshotParser.java:73)
... 19 more