Following This guide from Liquibase’s official website I’ve created my own changelog-master.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="https://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<includeAll path="/home/username/liquibase/examples/sqlite-test" filter="sql"/>
</databaseChangeLog>
I’ve then created the liquibase.properties
file in the same folder:
# Enter the path for your changelog file.
changeLogFile=changelog-master.xml
#### Enter the Target database 'url' information ####
url=jdbc:sqlite://home/username/liquibase/examples/sqlite-test/testdb
Which is correct because if I run a normal .sql changelog it runs correctly and updates my DB.
I’ve then created a changelog file in sql which has to be automatically executed when launching liquibase update
which is 000020-changelog.sql
--liquibase formatted sql
--changeset daniel:3
create table phonebook(name TEXT, surname TEXT, type TEXT, phone_number TEXT);
But when I go and launch liquibase update
I get an error from the XML parser:
Unexpected error running Liquibase: cvc-elt.1.a: Cannot find the declaration of element ‘databaseChangeLog’.
And I can’t understand what the problem is. I’ve checked multiple times if the changelog-master.xml
file is correct and it looks like it is. And from what I can find the cvc-elt.1.a
is an XML Parsing error, like databaseChangeLog
it’s not declared in the xml schema.
I’m doing this so that in the future I can create as many changelogs as I want and have them executed one after the other automatically.
I’ve been looking for some solutions for this problem but I can’t find anything. I’ve found a link to the official forums but it’s now a dead link.
Extra info:
- Liquibase version 4.0.0
- Installed JRE: openjdk 11.0.8 2020-07-14
- OS: Debian 10
- SQLite version 3.27.2
08/09/2020 edit:
as asked in the comments this is the project’s structure:
root@dev-machine:/home/username/liquibase/examples/sqlite-test# ls -la
total 68
drwxr-xr-x 2 root root 4096 Sep 4 17:28 .
drwxr-xr-x 5 username username 4096 Sep 4 17:02 ..
-rw-r--r-- 1 root root 139 Sep 4 13:35 000020-changelog.sql
-rw-r--r-- 1 root root 118 Sep 4 13:36 000030-changelog.sql
-rw-r--r-- 1 root root 201 Sep 4 17:05 000040-changelog.sql
-rw-r--r-- 1 root root 240 Sep 4 17:28 000050-changelog.sql
-rw-r--r-- 1 root root 456 Sep 4 14:22 changelog-master.xml
-rw-r--r-- 1 root root 2637 Sep 4 16:36 liquibase.properties
-rw-r--r-- 1 root root 32768 Sep 4 17:28 testdb
testdb
is the sqlite database I’m using to test liquibase. The .sql
files are the consecutive changelogs that must be run to update the DB
2
Answers
What was causing the issue I was having was the fact that in my
changelog-master.xml
I had an outdated XSD version, which was causing something to break into the XML Parser. To fix it I've changed it with the following:and moved all my *.sql files into the
schema/
folder. Other than that I've renamed all my.sql
files using the*.databasetype.sql
namescheme, in my case000020-changelog.sqlite.sql
. Had to do this because otherwise the files that used--liquibase formatted sql
wouldn't be executed.For me, this issue is more related to
http
andhttps
. The following shows the successful config:If
http
in any one of the three line is changed tohttps
, it will throw the exception: