Skip to content

KomMonitor/db-schema-migration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KomMonitor Schema Migration

Description

Collection of Liquibase changelogs for KomMonitor DB schema migration as well as useful scripts and Docker setups for generating changelogs.

Docker setup

The project comes with a Docker setup for deploying two different versions of the KomMonitor Data Management API, which initializes two PostgreSQL DBs with different schemas. For convenience and DB inspection, a pgAdmin instance will also be deployed. Just run docker compose up.

If you wish to run different versions of the Data Management API just adapt the docker-compse.yml to your needs.

Create Diff Changelog

You can create a changelog that contains changesets of two different KomMonitor schemas using the Liquibase Docker image with the following command (be aware of OS specific volume paths.):

docker run --network=kommonitor -v /home/user/changelog:/liquibase/changelog liquibase diff-changelog \
--author=kommonitor \
--changelog-file=changelog/kommonitor-changelog.xml \
--driver=org.postgresql.Driver \
--url="jdbc:postgresql://kommonitor-db-v4:5432/kommonitor_data_v4" \
--username=kommonitor \
--password=kommonitor \
--reference-url="jdbc:postgresql://kommonitor-db-v5:5432/kommonitor_data_v5" \
--reference-username=kommonitor \
--reference-password=kommonitor

The changelog is autogenerated and may contain several changesets that have to be improved. So, use the autogenerated changelog as a basis for developing a production-ready changelog.

Update DB

To apply a changeset to the DB that should be updated, use the command listed below:

docker run --network=kommonitor -v /home/user/changelog:/liquibase/changelog liquibase update \
--changelog-file=changelog/kommonitor-changelog.xml \
--driver=org.postgresql.Driver \
--url="jdbc:postgresql://kommonitor-db-v4:5432/kommonitor_data_v4" \
--username=kommonitor \
--password=kommonitor 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors