I’ve managed to fix the issue. In short since I was running Liquibase 4.0.0 it’s not compatible with the old version of the XSD I passed in the XML file. To Fix it I had liquibase generate a changelog from the existing DB and copied the XML declaration in my own changelog-master.xml file, which now looks like this:
But now I have another issue. If I put more sql statements in a file only the first one gets executed.
If I run liquibase updatesql i see the correct sql statements:
-- Create Database Lock Table
CREATE TABLE DATABASECHANGELOGLOCK (ID INTEGER NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED TEXT, LOCKEDBY VARCHAR(255), CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID));
-- Initialize Database Lock Table
DELETE FROM DATABASECHANGELOGLOCK;
INSERT INTO DATABASECHANGELOGLOCK (ID, LOCKED) VALUES (1, 0);
-- Lock Database
UPDATE DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '10.20.0.35 (10.20.0.35)', LOCKGRANTED = '2020-09-09 09:12:49.059' WHERE ID = 1 AND LOCKED = 0;
-- Create Database Change Log Table
CREATE TABLE DATABASECHANGELOG (ID VARCHAR(255) NOT NULL, AUTHOR VARCHAR(255) NOT NULL, FILENAME VARCHAR(255) NOT NULL, DATEEXECUTED TEXT NOT NULL, ORDEREXECUTED INTEGER NOT NULL, EXECTYPE VARCHAR(10) NOT NULL, MD5SUM VARCHAR(35), DESCRIPTION VARCHAR(255), COMMENTS VARCHAR(255), TAG VARCHAR(255), LIQUIBASE VARCHAR(20), CONTEXTS VARCHAR(255), LABELS VARCHAR(255), DEPLOYMENT_ID VARCHAR(10));
-- Changeset schemasql/000010-changelog.sql::raw::includeAll
create table users(id int primary key, username text, password text);
INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('raw', 'includeAll', 'schemasql/000010-changelog.sql', CURRENT_TIMESTAMP, 1, '8:1dcc42c194963b8c79824923636afb03', 'sql', '', 'EXECUTED', NULL, NULL, '3.10.2', '9635572458');
-- Changeset schemasql/000020-changelog.sql::raw::includeAll
create table phonebook(phone_number text, name text, surname text);
create table quickdial(quick_dial int, phone_number text, name text, surname text);
INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('raw', 'includeAll', 'schemasql/000020-changelog.sql', CURRENT_TIMESTAMP, 2, '8:75f3a8bd9f758dd20fc5e2bf69386af4', 'sql', '', 'EXECUTED', NULL, NULL, '3.10.2', '9635572458');
-- Changeset schemasql/000030-changelog.sql::raw::includeAll
create table user_options(user_id INT, option_text TEXT);
INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('raw', 'includeAll', 'schemasql/000030-changelog.sql', CURRENT_TIMESTAMP, 3, '8:58ce948a7d5b8f66e8ae46de3185e9b5', 'sql', '', 'EXECUTED', NULL, NULL, '3.10.2', '9635572458');
-- Changeset schemasql/000040-changelog.sql::raw::includeAll
insert into users values(2, "user", "psw");
insert into users values(3, "usern", "psw");
insert into users values(6, "nome", "pass");
INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('raw', 'includeAll', 'schemasql/000040-changelog.sql', CURRENT_TIMESTAMP, 4, '8:3097da9993349d3bff0d8e0abb6db702', 'sql', '', 'EXECUTED', NULL, NULL, '3.10.2', '9635572458');
-- Changeset schemasql/000050-changelog.sql::raw::includeAll
insert into users values(8, "name7", "psw");
insert into users values(9, "username7", "psw");
insert into users values(10, "nomeUtente", "pass");
INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('raw', 'includeAll', 'schemasql/000050-changelog.sql', CURRENT_TIMESTAMP, 5, '8:bdf4932b776a2d7853137b8528a3c1f5', 'sql', '', 'EXECUTED', NULL, NULL, '3.10.2', '9635572458');
-- Release Database Lock
UPDATE DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;
But then when i check into sqlite this is what i get:
In short it’s missing the quick_dial table and a lot of the users (this is just a test, that’s why I’m using plaintext “passwords”), any idea? By documentation this should work, but it’s not. I also have to use plain SQL since if I use --liquibase formatted sql that file doesn’t get executed for some weird reason. Even the most basic setup, following the Documentation step by step gives me issues, I don’t know what I’m doing wrong tbh