User-defined schemas don’t work with liquibase.
The following “db init” script is run as root against single-node insecure cluster.
CREATE USER IF NOT EXISTS ra_db_adm;
CREATE DATABASE IF NOT EXISTS ra_db;
CREATE SCHEMA IF NOT EXISTS ra AUTHORIZATION ra_db_adm;
GRANT ALL ON SCHEMA ra TO ra_db_adm;
Now as root, “SHOW GRANTS ON DATABASE ra_db;” shows schema grant
ra_db ra ra_db_adm ALL
among others, as expected. “show schemas” shows expected
However, as user ra_db_adm no grants are shown, no schemas are shown. Newly created schema is accessible as
CREATE TABLE ra_db.ra.table1 (col1 uuid);
works and later select from it works, too.
For liquibase, the effect is that 1st run succeeds as expected:
“Creating database history table with name: ra.databasechangelog”. As user ra_db_adm both selects work:
SELECT * FROM ra.databasechangelog;
SELECT * FROM ra_db.ra.databasechangelog;
But on the next runs of the same configuration, liquibase does not find its table, tries to recreate it and fails.
As I cannot see the ra schema in dbeaver when connected as ra_db_adm user I believe it is a problem in CockroachDB (information schema?) and not in liquibase.
The following settings were used for SpringBoot app:
and the following relevant libraries
P.S. If I drop the schema approach and fall back to pre 20.2 database/default-public-schema (i.e. make ra_db_adm the owner of the ra_db database and remove all schema-related stuff in init and liquibase) then the things work.