m2x4
July 5, 2022, 11:20pm
1
I’ve created a separate schema in Redshift for my changelog tables:
CREATE SCHEMA liquibase_non_prd;
ALTER DEFAULT PRIVILEGES IN SCHEMA liquibase_non_prd GRANT ALL ON TABLES TO GROUP readonly;
ALTER DEFAULT PRIVILEGES IN SCHEMA liquibase_non_prd GRANT ALL ON TABLES TO GROUP readwrite;
Liquibase creates my log tables but not in desired schema. Instead, I see them in public
.
In my db.config file I do use liquibaseSchemaName
parameter to no success.
cat <<eof > liquibase.properties
driver: com.amazon.redshift.jdbc42.Driver
url: jdbc:redshift://${bamboo_secret_deploy_host}:${bamboo_secret_deploy_port}/dbname?sslmode=verify-full
username: ${bamboo_secret_redshift_non_production_deploy_username}
password: ${bamboo_secret_redshift_non_production_deploy_password}
changeLogFile: src/main/resources/db/changelog/db.config-development.yml
liquibaseSchemaName: liquibase_non_prd
contexts: !norun
databaseChangeLogTableName: chg_lg_t
databaseChangeLogLockTableName: chg_lg_lck_t
clearCheckSums: TRUE
eof
mv liquibase.properties ${bamboo_result_artifactId}-${bamboo_result_version}/src/main/resources
In my bamboo logs I found below entry:
build 05-Jul-2022 18:43:32 [INFO] 'liquibaseSchemaName' in properties file is not being used by this task
Software version: liquibase-redshift 4.3.2
Ci-CD tool: Bamboo
Questions:
Why is this param not used?
How to get my desired schema populated with log tables?
Can I enforce Liquibase to create liquibase_non_prd
while running?
This sounds like it might be a bug. Can you submit a bug report here so our team can see if we can replicate the issue? How to Report Liquibase Issues and Bugs | Liquibase.org
1 Like
m2x4
July 18, 2022, 9:15pm
3
Below queries ran in order fixed the issue:
--run these ddls before first Liquibase run in target database
CREATE SCHEMA IF NOT EXISTS liquibase_non_prd;
GRANT ALL ON SCHEMA liquibase_non_prd TO GROUP readonly;
GRANT ALL ON SCHEMA liquibase_non_prd TO GROUP readwrite;
ALTER DEFAULT PRIVILEGES IN SCHEMA liquibase_non_prd GRANT ALL ON TABLES TO GROUP readonly;
ALTER DEFAULT PRIVILEGES IN SCHEMA liquibase_non_prd GRANT ALL ON TABLES TO GROUP readwrite;
--run these ddls after first Liquibase run in target database
GRANT ALL ON TABLE liquibase_non_prd.chg_lg_lck_t TO GROUP readonly;
GRANT ALL ON TABLE liquibase_non_prd.chg_lg_lck_t TO GROUP readwrite;
GRANT ALL ON TABLE liquibase_non_prd.chg_lg_t TO GROUP readonly;
GRANT ALL ON TABLE liquibase_non_prd.chg_lg_t TO GROUP readwrite;
m2x4
July 18, 2022, 9:27pm
4
@tabbyfoo - thx! I found a workaround but still worth incorporating into the tool
opened 09:26PM - 18 Jul 22 UTC
<!--- This environment context section helps us quickly review your PR.
… Please take a minute to fill-out this information. -->
## Environment
**Liquibase Version**: 4.3.2
**Liquibase Integration & Version**: Maven
**Liquibase Extension(s) & Version**: liquibase-redshift
**Database Vendor & Version**: AWS Redshift
**Operating System Type & Version**: Windows 10 with WSL2
**Infrastructure Type/Provider**: <AWC, GCS, Azure, VM, etc>: AWS
## Description
I created a seperate schema in Redshift for my changelog tables:
```
CREATE SCHEMA liquibase_non_prd;
ALTER DEFAULT PRIVILEGES IN SCHEMA liquibase_non_prd GRANT ALL ON TABLES TO GROUP readonly;
ALTER DEFAULT PRIVILEGES IN SCHEMA liquibase_non_prd GRANT ALL ON TABLES TO GROUP readwrite;
```
Liquibase creates my log tables but not in desired schema. Instead, I see them in public.
In my db.config file I do use `liquibaseSchemaName` parameter to no success.
```
cat <<eof > liquibase.properties
driver: com.amazon.redshift.jdbc42.Driver
url: jdbc:redshift://${bamboo_secret_deploy_host}:${bamboo_secret_deploy_port}/dbname?sslmode=verify-full
username: ${bamboo_secret_redshift_non_production_deploy_username}
password: ${bamboo_secret_redshift_non_production_deploy_password}
changeLogFile: src/main/resources/db/changelog/db.config-development.yml
liquibaseSchemaName: liquibase_non_prd
contexts: !norun
databaseChangeLogTableName: chg_lg_t
databaseChangeLogLockTableName: chg_lg_lck_t
clearCheckSums: TRUE
eof
mv liquibase.properties ${bamboo_result_artifactId}-${bamboo_result_version}/src/main/resources
```
In my bamboo logs I found below entry:
`build 05-Jul-2022 18:43:32 [INFO] 'liquibaseSchemaName' in properties file is not being used by this task.`
## Steps To Reproduce
Please use above code to create `liquibase.sh` file in bamboo specs/maven environment.
## Actual Behavior
Log tables get created in default `public` schema.
## Expected/Desired Behavior
Log tables get created in custom `liquibase_non_prd` schema.
## Screenshots (if appropriate)
N/A
## Additional Context
**Workaround** (could be implemented as a automatic behaviour of Liquibase in Redshift env)
Below queries ran in order fixed the issue:
```
--run these ddls before first Liquibase run in target database
CREATE SCHEMA IF NOT EXISTS liquibase_non_prd;
GRANT ALL ON SCHEMA liquibase_non_prd TO GROUP readonly;
GRANT ALL ON SCHEMA liquibase_non_prd TO GROUP readwrite;
ALTER DEFAULT PRIVILEGES IN SCHEMA liquibase_non_prd GRANT ALL ON TABLES TO GROUP readonly;
ALTER DEFAULT PRIVILEGES IN SCHEMA liquibase_non_prd GRANT ALL ON TABLES TO GROUP readwrite;
--run these ddls after first Liquibase run in target database
GRANT ALL ON TABLE liquibase_non_prd.chg_lg_lck_t TO GROUP readonly;
GRANT ALL ON TABLE liquibase_non_prd.chg_lg_lck_t TO GROUP readwrite;
GRANT ALL ON TABLE liquibase_non_prd.chg_lg_t TO GROUP readonly;
GRANT ALL ON TABLE liquibase_non_prd.chg_lg_t TO GROUP readwrite;
```
1 Like