Search notes:
Oracle Demo: Sync Database Schema Changes with Liquibase
$ sqlcl -nolog @run-liquibase.sql
lb generate-schema
lb generate-schema
captures the schema to which SQLcl is connected into a controller.xml
file in the current working directory.
This The controller file is acts as a change log that includes all files in the proper order to allow the schema to be deployed correctly.
cd liquibase/out
lb generate-schema
cd ../..
Compare generate-schema
with generate-changelog
.
lb changelog-sync
lb changelog-sync -changelog-file controller.xml -search-path liquibase/out
Tagging the current state
lb tag -tag "Release 1.0"
Developing release 1.1 on dev DB
lb diff-changelog
lb diff-changelog -output-file liquibase/out/controller.xml -reference-username &schema -reference-password &schema -reference-url jdbc:oracle:thin:@&dbDev
Deploy release 1.1 to prod DB
lb update -search-path liquibase/out -changelog-file controller.xml
Tagging release 1.1
lb tag -tag "Release 1.1"
Select data in account table
select * from account;
Developing release 1.2 on dev DB
lb diff-changelog
lb diff-changelog -output-file liquibase/out/controller.xml -reference-username &schema -reference-password &schema -reference-url jdbc:oracle:thin:@&dbDev
Deploy release 1.2
lb update -search-path liquibase/out -changelog-file controller.xml
Tagging release 1.2
lb tag -tag "Release 1.2"
Select data in account table
The column account_type
is renamed (but empty, because column was dropped and recreated).
select * from account;
Check if index was recreated
select
column_name
from
user_ind_columns
where
index_name = 'ACCOUNT_IX';
Show database changelog
select
tag,
filename,
to_char(dateexecuted, 'yyyy-mm-dd hh24:mi') exec_dt,
exectype,
description,
author
from
databasechangelog
order by
orderexecuted;