Bug 1861868 - [RFE] Allow for idempotent database migrations
Summary: [RFE] Allow for idempotent database migrations
Status: NEW
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Candlepin
Version: 6.8.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Lai
Depends On:
Blocks: 1867977
TreeView+ depends on / blocked
Reported: 2020-07-29 18:46 UTC by Eric Helms
Modified: 2020-08-11 10:06 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1867977 (view as bug list)
Last Closed:
Target Upstream Version:

Attachments (Terms of Use)

Description Eric Helms 2020-07-29 18:46:46 UTC
I would like to be able to detect if there are pending Candlepin database migrations to allow only running the migration task if there are. This helps the Satellite installer be idempotent.

[root@pipeline-upgrade-luna-nightly-centos7 candlepin]# ./cpdb --status --user=candlepin --password W7EkKTcVvT6W654kexPLFCQRNhDeoMxt
Configuring PostgreSQL with JDBC URL: jdbc:postgresql:candlepin
--driver=org.postgresql.Driver --classpath=/var/lib/tomcat/webapps/candlepin/WEB-INF/lib/postgresql-42.2.2.jar:/var/lib/tomcat/webapps/candlepin/WEB-INF/classes/ --url=jdbc:postgresql:candlepin --username=$DBUSERNAME --changeLogFile=db/changelog/changelog-update.xml --password=$DBPASSWORD --logLevel=severe
4 change sets have not been applied to candlepin@jdbc:postgresql:candlepin
Liquibase 'status' Successful

This would imply there are 4 changesets that need migrated and applied. If I then run 'migrate' I see it try to apply these changesets, mention "skip on failure" in the logs. This implies that this check will never return 0 as there are changsets that attempt to get applied, are skipped and the migration is OK with that.

Note You need to log in before you can comment on or make changes to this bug.