S
S
sanek_gyy2019-06-02 12:44:26
PostgreSQL
sanek_gyy, 2019-06-02 12:44:26

How to track the latest changes in postgre database?

How to fix changes (adding, deleting, updating) data in the database?
On a project, it is often necessary to fill in/correct the contents of the application's database and then have this content written to the database every time it is launched. How we do it at the moment:
1) Using liquibase, we create a changelog (dump) of the database;
2) Through the UI, we fill in / correct the necessary data
3) Using liquibase, we create a NEW changelog (dump) of the database with updated information;
4) With the help of intellij idea, we compare two changelogs and manually extract requests from the 2nd changelog (insert/update/delete) and insert them into the database rollup file when the application starts.
This method of solving the problem is very laborious for several reasons:
1) IDEA does not quite correctly compare the contents of files
2) Changelog requests are formed in the sequence of tables and rows in the database, and not according to the order of requests.
3) Working with xml files of tens of thousands of lines is in principle not convenient :)
How can this process be simplified and accelerated?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
taliano, 2019-06-03
@taliano

Specify in the database settings

log_statement = 'mod'
logging_collector = on
log_directory = 'pg_log'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'

After restarting the byzy, INSERT, UPDATE, DELETE, TRUNCATE, COPY FROM will fall into the log.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question